yii2-basic-app

What does it mean the colon in queries yii2 framework?

柔情痞子 提交于 2019-12-02 03:47:47
问题 I'm totally new in yii2 and I want to know what does it mean the colon in the query? I have made a research about binding parameters, but in the yii2 documentation says: // returns all inactive customers $sql = 'SELECT * FROM customer WHERE status=:status'; which side is from the data base? the left side or the right side? which is a simple text and which one is a column from the DB? Im so confused. what would be another way to make the query without the colon? is it valid? why it has 'anyo =

Auto login using “remember me” not working

女生的网名这么多〃 提交于 2019-12-02 03:17:11
I am new to Yii2. I'm using Yii 2 basic template. I have the "remember me" functionality implemented on my web application, but it is not working as I think it was supposed to. I can successfully log in (with a checked "remember me" checkbox). But after closing the browser and opening the website again I am not logged in, but instead redirected to the login page. I have set enableAutoLogin to true in the config file 'user' => [ 'identityClass' => 'app\models\User', 'enableAutoLogin' => true, 'authTimeout' => 86400, ], Make sure that your user model have implemented yii\web\IdentityInterface

URL not accepting alpha numeric parameter - Yii2-app-basic

瘦欲@ 提交于 2019-12-02 01:29:10
问题 As soon, i'm passing 41 in URL. confirm.php prints 41. http://localhost/yii2-app-basic/web/site/confirm/41 But, when i pass "cfeb70c4c627167ee56d6e09b591a3ee" or "41a" in URL, http://localhost/yii2-app-basic/web/site/confirm/41a it shows error NOT FOUND (#404) Page not found. The above error occurred while the Web server was processing your request. Please contact us if you think this is a server error. Thank you. I want to send confirmation id to user to confirm their account. That's why

Custom Validation Not Working- Yii2-app-basic-Yii2

扶醉桌前 提交于 2019-12-01 21:52:41
问题 I Posted one question yesterday regarding custom validation for radio button Textfield Mandatory On Radio Button. I got answer. But, that was not exact answer. But, it solved one problem of mine. Actually, I've 2 radio button. Individual Firm When, Radio Button having "Individual" value is selected, CompanyName textbox should not be mandatory. But, when Radio Button having "Firm" value is selected, CompanyName textbox should be mandatory. Now what happening is, When i select radio button

Two different layouts for Guest User & Logged in User- Yii2

老子叫甜甜 提交于 2019-12-01 07:46:52
问题 Previously, I was having main.php where header & footer were declared. Which is Ok. Now, I am looking for 2 different layouts for Guest User & Registered User . In which Registered User and Admin will have different header & footer. I am using Yii2 Basic App. I created GuestUser.php & RegisteredUser.php inside views/layouts/ folder. Guest User means User has not logged in the application. And, Registered User means User Has logged in the Application. Now, My directory structure is like this.

Nginx Yii2 configuration in different folders

≯℡__Kan透↙ 提交于 2019-11-30 09:43:06
问题 I faced with problem in configuring nginx server for yii2 basic app. Here is my service block file : server { listen 80 ; access_log /var/log/nginx/access-server.log; error_log /var/log/nginx/error-server.log; charset utf-8; location /fetch { root /usr/share/nginx/html/another_folder/web/; try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document

Nginx Yii2 configuration in different folders

末鹿安然 提交于 2019-11-29 15:44:06
I faced with problem in configuring nginx server for yii2 basic app. Here is my service block file : server { listen 80 ; access_log /var/log/nginx/access-server.log; error_log /var/log/nginx/error-server.log; charset utf-8; location /fetch { root /usr/share/nginx/html/another_folder/web/; try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } My project located in another folder "another

LIMIT is not working in ActiveDataProvider

守給你的承諾、 提交于 2019-11-27 09:26:19
Hi guys i am using following code and the limit doesnt work, but if i see the command than it shows limit in that but when i pass the query to ActiveDataProvider it fetch all the records $data= User::find()->where(['category_id'=> 5])->orderBy(['rand()' => SORT_DESC])->limit(4); $command = $data->createCommand(); $data2 = $command->queryAll();// This works fine and fetch only 4 data $dataProvider = new ActiveDataProvider([ 'query' => $data, ]); // But this displays all data without limit What is wrong i am doing here??? Here is what happens when preparing models in yii\data\ActiveDataProvider

model->save() Not Working In Yii2

扶醉桌前 提交于 2019-11-26 21:19:10
问题 Previously, I was not using $model->save() function for inserting or updating any data. I was simply using createCommand() to execute query and it was working successfully. But, my team members asked me to avoid createCommand() and use $model->save(); Now, I started cleaning my code and problem is $model->save(); not working for me. I don't know where i did mistake. UsersController.php (Controller) <?php namespace app\modules\users\controllers; use Yii; use yii\web\NotFoundHttpException; use

LIMIT is not working in ActiveDataProvider

妖精的绣舞 提交于 2019-11-26 14:35:39
问题 Hi guys i am using following code and the limit doesnt work, but if i see the command than it shows limit in that but when i pass the query to ActiveDataProvider it fetch all the records $data= User::find()->where(['category_id'=> 5])->orderBy(['rand()' => SORT_DESC])->limit(4); $command = $data->createCommand(); $data2 = $command->queryAll();// This works fine and fetch only 4 data $dataProvider = new ActiveDataProvider([ 'query' => $data, ]); // But this displays all data without limit What