Tag: yii2

67 votes
3 answers
2.7K views
Yii2 subquery in Active Record

How can I convert this sql into active record query SELECT * FROM `base_twitter` WHERE id NOT IN (SELECT base

avatar
Leonardo
0 1 0 9
asked 07 September, 2021
62 votes
2 answers
1.6K views
Yii2 global filter/behavior to force user to authenticate first

In my Yii2 application I'm trying to force all users to be authenticated. If they're not already aut

avatar
Dwain
0 1 0 9
asked 07 September, 2021
52 votes
5 answers
2.2K views
How to do IS NULL and IS NOT NULL with Yii 2 ActiveRecord?

I have a table which has a field `activated_at` timestamp NULL DEFAULT NULL, which means that it can contain a

avatar
Don
0 1 0 9
asked 07 September, 2021
57 votes
4 answers
2.4K views
Yii2 request parameter from url

In YII I could request a parameter from url and populate a form field called companyAdd_id with the following

avatar
Jeff
0 1 0 9
asked 07 September, 2021
53 votes
5 answers
3.1K views
Create button with link in Yii2

I am trying to setup a button with a link to a view. However yii\bootstrap\Button does not have a property url

avatar
Tana
0 1 0 9
asked 07 September, 2021
51 votes
2 answers
1.7K views
Yii2 how does search() in SearchModel work?

Please can someone explain how the search method in a Yii2 SearchModel works? I generated it using Gii. Here i

avatar
Keith
0 1 0 9
asked 07 September, 2021
59 votes
1 answers
1.1K views
Yii2: How to use orWhere in andWhere

I want create this query with yii2 search model select * from t1 where (title = 'keyword' or conte

avatar
Elicia
0 1 0 9
asked 07 September, 2021
57 votes
4 answers
1.8K views
Yii 2.0 How to generate form without <div class="form-group">?

<?php $form = ActiveForm::begin(['id' => 'contact-form']); ?> <?= $for

avatar
Scot
0 1 0 9
asked 07 September, 2021
56 votes
2 answers
1.3K views
Yii2: Why is the auth key in class User?

As the title clarifies why is the auth key introduced in Yii2? What're it's main usages and how it i

avatar
Adolfo
0 1 0 9
asked 07 September, 2021
61 votes
3 answers
1.9K views
What is the difference between $with and $joinWith in Yii2 and when to use them?

In the API documentation it is specified that $joinWith - A list of relations that this query should be j

avatar
Roger
0 1 0 9
asked 07 September, 2021
56 votes
7 answers
1.6K views
Hide label for input field

I am trying to hide the label for a specific field in _form.php without success. I have tried couple of varia

avatar
Royal
0 1 0 9
asked 07 September, 2021
54 votes
4 answers
1.2K views
Yii2 : Active Record add Not In condition

What is the active Record way of adding IN condition to an active Query in yii 1.x you could use CDbCriteria l

avatar
Sachiko
0 1 0 9
asked 07 September, 2021
60 votes
9 answers
549 views
How to set the default controller in yii2

I have UserControler and I run it in virtual server http://basic.com/index.php?r=user/index. How can I set up

avatar
Ali
0 1 0 9
asked 07 September, 2021
66 votes
10 answers
2.9K views
Getting base URL in Yii 2

I am trying to get the base URL for the project in Yii 2 but it doesn't seem to work. According to this p

avatar
Jesenia
0 1 0 9
asked 07 September, 2021
51 votes
6 answers
1.9K views
How to use the swiftMailer in Yii2

I can't finally understand how to use the swiftMailer extension in Yii2. Judging by that on this subject

avatar
Nereida
0 1 0 9
asked 07 September, 2021
49 votes
8 answers
2.8K views
URL in Yii2 GridView

I have this code: <?php echo GridView::widget([ 'dataProvider' => $dataProvider, 'fi

avatar
Tana
0 1 0 9
asked 07 September, 2021
55 votes
8 answers
1.5K views
Yii2 How to perform where AND or OR condition grouping?

I am new to Yii-2 framework. How can i achieve following query in Yii-2 framework using activeQuery and models

avatar
Venice
0 1 0 9
asked 07 September, 2021
56 votes
8 answers
449 views
Yii2 data provider default sorting

In Yii 1.1 this code works for default sorting: $dataProvider = new CActiveDataProvider('article',a

avatar
Roger
0 1 0 9
asked 07 September, 2021