Questions tagged as 'yii2'

2
answers

Call a controller action for the views

I'm using Yii2 and doing a site project where one of the features is to list the movies bound to a specific user. I already have a method to associate the movies with the accounts and one that does the inner join of the tables. (Actions Code)...
asked by 15.12.2017 / 18:03
2
answers

Remove Div on which the element is included

I have a form, where I make the clone (jQuery) to add new inputs, where I can also remove them. The problem that occurs is: I need to remove the "current" div where the remove button is located. And currently I can only remove the last element...
asked by 23.11.2018 / 14:57
3
answers

How to format an array php

I am doing a SQL query in my model and controller , I am printing the array values. The view looks like this: Array ( [campo1] => 98 [campo2] => SOLO [soma] => 1 ) Array ( [campo1] => 92 [campo2] => DARTH [soma] => 11...
asked by 10.09.2018 / 22:21
1
answer

Upload a json into a DropDownList Yii2

I recently migrated to the YII 2 framework. And I have one small question: I have a json that I need to pop a DropDownList. The Json file: [ {"codigo": "05", "descricao" : "Administrador"}, {"codigo": "10", "descricao" : "Diretor"}, {"codigo":...
asked by 01.11.2018 / 20:09
1
answer

Dependent Double DropDown on Yii2

How can I solve this implementation below, so that it executes the 2 dependency routines associated with the same onChange event: Example: <?php echo $form->field($model, 'id_data_type', [ 'hintType' => ActiveField::HINT_SP...
asked by 19.03.2018 / 14:17
1
answer

Update with two model Yii2

I'm studying on Yii2 and I do not have much knowledge of the framework. I'm having trouble updating database data in two different models (Student and Address). The idea is simple, load the view with the student data (which has the address...
asked by 10.05.2018 / 04:44
1
answer

Serial ID not assigning to model id

I'm making a website that gets through a Webservice, the data from a dvd (from a colleague's website), and creates an offer with its information. I think I'm having a problem with MVC structuring and not with the framework itself. public funct...
asked by 17.10.2018 / 18:44
1
answer

Searching for existence of record before including a new one (Yii 2)

Hello Everyone! In the create.php of a view (ANOLETIVO), I search if there is a record in the table with status = 1. If it exists, the new inclusion should not be allowed. I already did this on Yii 1 but I'm "catching" on Yii 2 ....
asked by 20.02.2018 / 21:10
1
answer

How to pass a variable into a callback in php with Yii2

I'm trying to make a rather abstract method that would execute a yii2 query depending on the attribute passed my code is: public static function getModelosQuePodemTer($atributo) { self::$helper = $atributo; return self::find()...
asked by 28.02.2018 / 15:51
1
answer

Yii2 - How to sort the gridview on a [POST] form without losing the filters using arrayDataProvider

I have a form with 14 search fields and half of these fields are arrays, so the form's method is POST otherwise it displays error    (414 - Request URI too long). I am using gridview to render results with pagination = 10 , but wh...
asked by 14.12.2018 / 19:35