Questions tagged [yii2]

Yii 2 is the latest version of the Yii framework - a high-performance, component-based PHP framework

Yii Framework

Yii is a generic Web programming framework, meaning that it can be used for developing all kinds of Web applications using PHP. Because of its component-based architecture and sophisticated caching support, it is especially suitable for developing large-scale applications such as portals, forums, content management systems (CMS), e-commerce projects, RESTful Web services, and so on.

Yii 2.0 is the current version of the Yii PHP framework, released on October 12, 2014. The latest version can be downloaded from the Yii website. Guidelines on how to upgrade minor Yii 2.0 version and changelog can be found here.

Yii 2.0 is a complete rewrite of Yii 1.1 based on PHP 5.4 improvements and aims for simplicity, performance and extensibility. The framework adopts namespaces and traits, PSR standards, , and . Yii 2.0 implements the dependency injection container and service locator. It makes the applications built with Yii more customizable and testable.

Official documentation can be found in the Definitive Guide to Yii 2.0. Further important documentation sources:

More information on the current project status can be found in the Yii 2.0 release announcement and the project roadmap.

15456 questions
3
votes
1 answer

How to display filtering model relations on a GridView

I have two tables: Country City And have relations in model. Why doesn't city have a filter? public function getCountry() { return $this->hasOne(Country::className(), ['id' => 'c_id']); } GridView image:
Denis
  • 31
  • 1
3
votes
3 answers

Yii2 - How to make a sum of my column in GridView?

How do I sum up the values of a column in my GridView and display the total? My GridView: $dataProvider = new ActiveDataProvider([ 'query' => Accounts::find()->where('account_type=1'), 'sort'=> ['defaultOrder' =>…
drich
  • 69
  • 1
  • 8
3
votes
2 answers

How to Reload a Bootstrap Modal popup in Yii2?

I have a Modal popup, after the user submit the data, I want to show the results on the same popup. How do I reload that modal view? Thanks. This is the popup view:

title) ?>

Jan Beeck
  • 303
  • 8
  • 24
3
votes
3 answers

How to correctly specify migration namespace classes in yii2?

could someone explain me how can I correctly specify my modules migration namespaces? As I see in the documentation, it's: return [ 'controllerMap' => [ 'migrate' => [ 'class' => 'yii\console\controllers\MigrateController', …
HELPME
  • 714
  • 14
  • 35
3
votes
1 answer

Yii2: run console command from controller in vendor directory

I am doing some refactoring of our large work app. This involves separating out some tools I've build, like a schema/seed migration tool for the command line, in to their own repositories to be used by multiple applications. If it's in…
diabetesjones
  • 838
  • 1
  • 7
  • 17
3
votes
4 answers

Class 'Google_Client' not found

I have create a component :
Arunendra
  • 570
  • 2
  • 10
  • 34
3
votes
1 answer

Yii2 required validation rule on "select2" widget

I'm using kartik select2 widget in Yii2 framework. Required validation rule doesn't work on it. Here is my view code: $form->field($model, 'city')->widget(\kartik\select2\Select2::classname(), [ 'data' => $cities, 'options'…
Ali Tavafi
  • 443
  • 1
  • 10
  • 28
3
votes
3 answers

filter for custom column in grid view which is not in table yii2

I have added this 'sla_status' field in gridview and every thing is working fine only issue is I am unable to set filter values for this. 'sla_status' is not in my table. [ 'label' => Yii::t('app','Sla Status'), 'format' =>…
deepak
  • 62
  • 2
  • 8
3
votes
1 answer

Yii2: failed to open stream: No such file or directory

i have problem with my upload/update function in Yii2 framework. My update function: public function actionUpdate($id) { $model = $this->findModel($id); // $model->scenario = 'update'; if…
3
votes
2 answers

error for session in yii2

I save session in mysql db in yii2 but have problem some times with error ، I think the session destroy in period of time and show the error message and when i refresh page that problem is solved error message: PHP Notice 'yii\base\ErrorException'…
mohammad zahedi
  • 313
  • 3
  • 17
3
votes
2 answers

Yii2 Adding rules in models if the record is already exists in database

My problem is validating the records if already exists in database. So i created a Officials Form using Gii Generator in yii2. It contains name_id,position,fname,mname,lname. If the admin wants to create a new data, and that data is already exists…
user7978226
3
votes
1 answer

Update one-to-many relation entries without touching unaffected rows

We have two models "Foo" and "Bar" like in the picture below (one Foo can have many Bars). Let's say that we want to update Foo model with values from $_POST. Because of Foo relation with Bar, we also want to update Bar model with values from same…
Kamaronas
  • 153
  • 1
  • 9
3
votes
1 answer

Why swiftmailer doesn't show senders email in yii2?

I have a problem here. I created a Contact form in my webpage, which includes: name, surname, email and description. When I submit my form, the email sends, but the senders email is my email.…
HarryFlopper
  • 195
  • 1
  • 2
  • 10
3
votes
1 answer

Integrate paytm in Yii2

How can i integrate paytm in yii2 ? Is there any module for paytm integration for yii2 ?
Ashish
  • 63
  • 4
3
votes
1 answer

(yii2) error 404 page not found

This is my SiteController public function actionIndex(){ $data['book']=[ ['id'=>1] ['id'=>2] ['id'=>3] ]; return $this->render('index',$data); } public function actionView($id){ …
STepHan
  • 57
  • 1
  • 11