Questions tagged [yii2-basic-app]

Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small projects.

Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small projects.

The template contains the basic features including user login/logout and a contact page. It includes all commonly used configurations that would allow you to focus on adding new features to your application.

GitHub

Official Site

800 questions
27
votes
25 answers

Yii2: How to add textarea in yii2

What is the mapping of textarea in yii2 ? How to write this in yii2 format? What is an alternative or way to define textarea in yii2?
user4428957
19
votes
10 answers

model->save() Not Working In Yii2

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…
Nana Partykar
  • 10,556
  • 10
  • 48
  • 77
15
votes
2 answers

LIMIT is not working in ActiveDataProvider

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()'…
Mike Ross
  • 2,942
  • 5
  • 49
  • 101
12
votes
2 answers

Order by rand() in yii2

I want to write following query in yii2, but I can't get the expected output: SELECT * FROM user where category_id=5 ORDER BY rand() LIMIT 4 For that I have done following: $data= User::find()->where(['category_id'=>…
Mike Ross
  • 2,942
  • 5
  • 49
  • 101
11
votes
2 answers

The configuration for the "modules" component must contain a "class" element

I have define a module named `admin' in yii2. I have registered this module in web.php config file. But when I try to access this I face with an error. here is my web.php
Behzad Hassani
  • 2,129
  • 4
  • 30
  • 51
10
votes
2 answers

ActiveForm without model yii2

I want to create ActiveForm without model for just in case something. I did try with dynamicModel but i got some error : use yii\base\DynamicModel; $model = DynamicModel::validateData(compact('KOMENTAR'), [ [['KOMENTAR'], 'string', 'max' =>…
9
votes
1 answer

How can I upgrade Yii 1.x to Yii 2.0?

How can I upgrade the Yii 1.x version to the Yii 2.0 latest release version? I am using an Ubuntu OS. What is the process to updating my old Yii to the new Yii release version 2.0?
8
votes
1 answer

How to display a HTML tag in Yii2 form error summary

I am trying to display a link in error message in login for, but it is not working. The error message in LoginForm valdiation: $this->addError($attribute, 'Your account has been disabled. Enable It'); In login.php (view):
7
votes
2 answers

Yii2 WHERE IN query

The following active record WHERE IN query does not work. According to the docs this should work: $data = $dropDownData->find() ->select('country, country_text') ->distinct() ->WHERE(['in',…
user794846
  • 1,881
  • 5
  • 29
  • 72
7
votes
2 answers

Yii2 enforce 404 or 500 error

In my controller's action of Yii2 application suppose the following: public function actionView($i) { if ($i < 20) { //I want execute error 404 } } All what I can to do now is just setting a flash message and redirect to another action.…
SaidbakR
  • 13,303
  • 20
  • 101
  • 195
6
votes
1 answer

Yii2 full calendar event filtering not working

I'm using Philipp Frenzel FullCalendar in Yii2 framework and its working perfectly. I want to implement basic filter events on calendar base on option select but my codes still not working. Help would be highly appreciated. This is inside…
Hendy
  • 265
  • 1
  • 6
  • 27
6
votes
1 answer

How to control visibility of buttons in ActionColumn of yii2 GridView when using yii2 RBAC with a rule class?

I understand the visibility of ActionColumn buttons can be controlled like this : $dataProvider, 'filterModel' => $searchModel, 'columns' => [ ['class' =>…
6
votes
2 answers

Invalid validation rule: a rule must specify both attribute names and validator type, in Yii2

In my basic app project, I'm trying to integrate the signup form, I'm getting this error: Invalid validation rule: a rule must specify both attribute names and validator type. My code is here. SignUpForm.php
Mohan Prasad
  • 682
  • 1
  • 9
  • 34
6
votes
2 answers

How to Create a REST API for Yii2-basic-template

I wanted to create a REST API for a yii2 basic template. I followed the following link. I created a table named users, a controller named UserController
Bloodhound
  • 2,906
  • 11
  • 37
  • 71
5
votes
2 answers

Pretty URL for one single controller (module) in yii2

Suppose my application path is:- http://www.example.com/index.php?r=dashboard/event/view I make a new controller on which I want to change the URL to pretty URL. Default URL for the new…
pawansgi92
  • 1,065
  • 13
  • 32
1
2 3
53 54