15,554 questions
0
votes
0
answers
16
views
Yii2 advance issue with Docker and pretty Url
i've use Yii2 Advence Template and the official Docker image like describe in the documentation docker section
The project works with this address (for backend) http://127.0.0.1:21080.
But in my ...
0
votes
0
answers
23
views
My URL is not calling the function of the controller Yii2
I have a function name import in the contact controller. The issue is that when I am trying to make a call to the function with https://example.org/contact/import, the import function is not executing....
1
vote
0
answers
20
views
The render() method takes a long time to execute Yii2
I just get a form with several fields. if in the controller method before return $this->render() I do echo 'Success!';exit;, then the page loads quickly. and when $this->render() is called, the ...
0
votes
0
answers
29
views
Yii2 Search Model joinWith has no relation named
Error: admin\models\DormitoryFloorModel has no relation named "dormitory_model".
I use postgresql db.
Controller action:
public function actionIndex() {
$searchModel = new ...
0
votes
0
answers
18
views
When using HttpHeaderAuth, the findIdentityByAccessToken method is not called
Yii2
When i put var_dump in findIdentityByAccessToken method is not called
Why is findIdentityByAccessToken method not called?
Why is there no user verification?
curl -H "Authorization: Bearer ...
-2
votes
1
answer
45
views
Yii2 Active Record Order By Primary Key ID not working [closed]
I have a pretty basic Yii2 ActiveRecord query.
$paperList = Paper::find()->orderBy(['id' => SORT_DESC])->all();
id is my primary key column which is of type int and AUTO_INCREMENT.
When ...
0
votes
0
answers
65
views
Cannot Implicitly convert 'array' to 'string'...sending data from controller to chart js
Need help with my code
The problem is I tried to pass array from the controller to my page that contain a bar chart. But the chart cannot be displayed because it doesn't correctly received the array I ...
0
votes
1
answer
26
views
Is there a way to get the date "mask" used by Yii2 formatter automatically (according to the system language configuration)?
Here's my problem: I have a date field in a Yii2 form that I am formatting as showed in the following snippet:
<?= $form->field($model, 'date_last_purchase')->widget(DatePicker::class, [
'...
1
vote
1
answer
35
views
Yii2 ActiveForm CheckboxList Group Seperator
I am trying to place a line in between a list of values in a Yii2 CheckboxList. For now I am just trying to get it to work using the yii Bootstrap 5 Html form field.
When using this:
<?= Html:...
0
votes
1
answer
33
views
composer package with repo VCS not working
I have a fork repo in composer.json, but composer keep getting last release from forked one (1.1.4) instead of mine (1.1.6) from VCS.
If I do: composer show -a kalyabin/yii2-select-google-map-location ...
0
votes
1
answer
23
views
Yii2 has option to enable custom error handling, but is there option to enable custom exception handling?
Yii2 documents custom error handling here https://www.yiiframework.com/doc/guide/2.0/en/runtime-handling-errors and it separates error handling from exception handling:
@yii/views/errorHandler/error....
2
votes
0
answers
25
views
Yii2 - mysql default blank string displays as two single quotes in form field
I got table in MySQL with default blank string value. In SQL it looks like:
`key` TINYTEXT NOT NULL DEFAULT '',
In the model i set rule with blank string as default value:
[['key'], 'default', 'value'...
1
vote
0
answers
106
views
Cannot send email with `symfony/mailer`, but native function `mail` works
I have a server configured with DKIM and the native mail function seems to respect that and sends out emails without a problem.
However, I need to use symfony/mailer (wrapped by yiisoft/yii2-...
1
vote
1
answer
41
views
how can i get the last row with a given foreign key in yii2 with relations?
i have 2 tables
tickets:
-id
etc..
comments:
-id
-ticket_id
-datetime
etc...
ticket_id is the ticket's id on which the comment was made.
one ticket can have 0 or more comments in this way
how should ...
0
votes
0
answers
35
views
Yii2 Cache-control
i've read the documentation about YII2 Caching
So i set on my controller
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::class,
...
0
votes
0
answers
34
views
yii2 why are buttons rendered outside bootstrap modal
<?php
$yesBtn = Html::submitButton('yes', ['class' => 'btn btn-primary']);
$noBtn = Html::submitButton('no', ['class' => 'btn btn-secondary']);
$modal = Modal::begin([
// ...
'...
1
vote
0
answers
29
views
PhpStorm is marking variables given by Controller in View as not declared in MCV application
PhpStorm is marking variables given by Controller in View as not declared in Yii2 application. Why? How can I turn off this faulty message of PhpStorm?
return $this->render('resetPassword', [
'...
0
votes
1
answer
32
views
How to bind parameters with yii2 CreateCommand
When i run this code:
$params = [':idCollection' => $idCollection, ':idBlock' => $idBlock];
//dd($params);
Yii::$app->db->createCommand()->insert('...
0
votes
0
answers
29
views
How to create environment variables with the the package vlucas/phpdotenv for yii2 advance template
I installed the package:
composer require vlucas/phpdotenv
and in the root of my project i have a .env file with some configuration variable.
Now i try to use PHP dotenv to get the ENV variable ...
0
votes
0
answers
33
views
Yii2 env with Yii2 Schedule cannot read env value for console Controller
I use the following extensions.
https://github.com/omnilight/yii2-scheduling
https://packagist.org/packages/yiithings/yii2-dotenv
Then I have a controller located at commands/...
0
votes
0
answers
38
views
Yii2 Module loading, but 404 with every route in this module
In my yii2 project I added a new module 'v2' (mirror of v1 + the new changes - v1 running great). Of course I replaced all v1 with v2 and checked for the correct cases.
I registered the module in the ...
0
votes
0
answers
41
views
Refactor Yii monolith to angular micro-frontends (nx-monorepo)
I have a big monolith project written on PHP (Yii) and JavaScript (jQuery).
What strategy can I choose to refactor this monolith into angular micro-frontends (nx-monorepo)?
I also want to use SSR.
...
0
votes
0
answers
36
views
Yii2 Docker Mysql can connect to heidi sql
I've installed the yii2 advance application and run the default docker-compose.yml file
docker compose build
after that i run
docker compose up
and, in my docker desktop i can see everything is ok.
...
0
votes
0
answers
48
views
Yii2 tests not flush db changes on disk. How to disable it?
I got simple ActiveRecord model (CRUD from Gii) and unit tests for that, with one simple adding test.
In the test i just fill model fields and call $model->save(). After that, test check tables row ...
0
votes
1
answer
31
views
How to perform additional calculations for items displayed on the current page in Yii2 ArrayDataProvider?
I am creating an ArrayDataProvider like this:
$dataProvider = new ArrayDataProvider([
'allModels' => $data,
'sort' => [
'attributes' => [
'quantity',
],
...
1
vote
1
answer
23
views
In Yii2, is it possible to get the unique objects in a hasMany relation via another hasMany relation?
Say I have an Order model which has some associated Product models, so there's a relation in Order:
public function getProducts() {
return $this->hasMany(Product::class, ['id' => '...
0
votes
0
answers
28
views
Unable to find class in file
Unknown Class - yii\\baselUnknownClassException
Unable to find 'app|components|GlobalComponent' in file:
/Applications/MAMP/htdocs/harmony-cdn/components/GlobalComponent.php. Namespace missing?
I ...
0
votes
0
answers
35
views
How to disable gridviev sorting icon
ı want to disable gridview sorting icon
I want my sort icon to appear only after the first word, but it appears at the end of that title.
'label' => Html::tag('div', Yii::t('app', 'Create Date'), ...
0
votes
0
answers
70
views
How to register an Asset Bundle in Craft CMS 3.x to style a Twig template?
I'm trying to create and register an Asset Bundle in Craft CMS 3.x to include a custom CSS file for styling a Twig template. I've followed the official documentation provided by Craft CMS: Asset ...
0
votes
0
answers
50
views
How to send mail in Yii2 using the Google Oauth2.0 protocol?
I have a system in Yii2 that sends emails and has a basic configuration where user and password is used as a sender. What I need is to change that configuration to use the Google Oauth 2.0 protocol, I ...
0
votes
0
answers
30
views
How to send email from Yii2 through Google Workspace with Oauth authentication
Google says: "Starting on September 30, 2024, less secure apps, third-party apps, or devices that have you sign in with only your username and password will no longer be supported for Google ...
0
votes
1
answer
32
views
Yii2 console help gives double entry for my module
I created a custom module with console command yii gii/module
I get a double entry with console command yii help
screenshot with double entry for module
this is the directory tree
app/modules/...
1
vote
1
answer
46
views
What are the rules for interpreting "logically ambiguous" queries in Yii2?
In Yii2, you can add clauses to queries such as:
Product::find()
->where(['name' => 'MyProd'])
->andWhere(['type' => 'Toy'])
->orWhere(['category' => 'MyCat'])
->andWhere(['...
0
votes
0
answers
26
views
Yii2 Problem in console command with yii2 container
I have console command for my queue.
An error occurs when running a command from a queue. What the problem?
"session_set_cookie_params(): Cannot change session cookie parameters when headers ...
0
votes
0
answers
34
views
Yii2 mongodb query way faster in shell then php
mongo shell
db.runCommand({explain:{count:'galleries',query:{ "$and": [{ "status": { "$eq": "published" }, "type": { "$ne": "picture&...
0
votes
0
answers
46
views
Problem with Fetch user profile picture in Zoho cliq
I've to fetch the user details in Zoho cliq. But in response I'm not getting profile picture or it's url.
https://www.zoho.com/cliq/help/restapi/v2/#retrieve-particular-user
Above is the API ...
0
votes
2
answers
50
views
Yii2 How to keep modified data when rules fail
I am going mad trying to figure this out. I have a form which loads data from a current user in my database. When I click on submit, the rules are fired and I get my error message, however the new ...
0
votes
0
answers
22
views
Yii2 azure hosting
I have created a web app on a Linux profile.
After that, I followed these steps:
cd path/to/your/yii2-app
git init
git add .
git commit -m "Initial commit"
git remote add azure <your-...
0
votes
1
answer
90
views
Yii2 passing of Data from model to view throws undefined array key exception even after render
In Yii Frontend, I have learned that to pass the data from Model to view, you have to use the siteController or a dedicated Controller then make sure they are included in the data array passed to the ...
0
votes
0
answers
67
views
I want to create a group on Zoho Cliq, assign member to the group and able to fetch the chat
I want to create a group on Zoho Cliq, assign member to the group and able to fetch the chat.
I'm getting error invalid url
I've tried this=
Request method: POST
API endpoint.: https://cliq.zoho.com/...
0
votes
1
answer
69
views
How to get the sql of CreateCommand in Connection
Yii::$app->db->createCommand($sql)->queryAll();
How to get $sql
Need to record all sql in createCommand
It has been used in many places. How to record which sql is executed for each request ...
0
votes
0
answers
34
views
Yii2 form submitting twice when using imageuploadify
I have a Yii2 form that uses imageuploadify to load images. The form is being submitted twice, resulting in multiple entries on the create action.
My controller function is checking for Ajax but the ...
0
votes
0
answers
55
views
How to dynamically change which site is servered
I have a scenario where I need to basically deliver a different website based on the time of year. In Dec they want a Christmas site delivered, other wise the regular one. To the visitor they shouldn'...
0
votes
1
answer
33
views
How to manage routes in Yii2 when 'urlManager' array does not exist?
I have inherited a Yii2 application to maintain, and although I use plain PHP and Laravel, I do not know enough about this framework. Therefore, I feel very insecure and confused at times.
For example,...
0
votes
0
answers
46
views
how to send multiple files and some data in a single response
I'm writing online-library using Vue and Yii2. I need to somehow send books info and related pics.
I tried to send at least pictures but in postman i see that response contains only 1 picture
public ...
0
votes
0
answers
21
views
not able to add or update fileds which is added manually in mailwizz tables
i am getting strange issue, i am using mailwizz extension, i added 4 fields in customer company table, those fields are state,way,mc and subscribers, this is my controller where i am storing data
$...
0
votes
1
answer
50
views
How to add a new attribute to thousands of Mongodb documents in yii2 performant?
I have php + yii2 + mongodb running on linux in virtualbox (10 cores, 12 GB RAM). yii2-mongodb is installed. I have a csv file that contains 100.000+ records in 2 columns: custom identifier (not _id), ...
1
vote
2
answers
56
views
Creating default object from empty value in YII2
Code that causes problem
foreach ($items as $itemData) {
$item = new PurchaseItem();
$item->internal_product_id = (int)$itemData['internal_product_id'];
$item->quantity = (float)$...
0
votes
1
answer
55
views
Why is the column name's alias in lowercase and not the expected one?
On the staging, I am working with PHP 7 on the Yii2 framework, where I have a connection with MySQL 8 database.
On the production, the code is run on PHP 5.6 with the same Yii2 framework, where I have ...
0
votes
1
answer
54
views
Unable to view a pop-up modal properly in yii2
I am trying to show a pop-up modal on a button click. But when I click on the button it shows for a small time and then vanishes leaving the screen to black.
Below is my code
<?PHP
use kartik\...