"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "framework/UPGRADE.md" between
yii2-2.0.36.tar.gz and yii2-2.0.37.tar.gz

About: Yii 2 is a high-performance component-based PHP framework for developing large-scale Web applications (source).

UPGRADE.md  (yii2-2.0.36):UPGRADE.md  (yii2-2.0.37)
skipping to change at line 54 skipping to change at line 54
any restrictions. any restrictions.
After upgrading you should check whether your application still works as expecte d and no tests are broken. After upgrading you should check whether your application still works as expecte d and no tests are broken.
See the following notes on which changes to consider when upgrading from one ver sion to another. See the following notes on which changes to consider when upgrading from one ver sion to another.
> Note: The following upgrading instructions are cumulative. That is, > Note: The following upgrading instructions are cumulative. That is,
if you want to upgrade from version A to version C and there is if you want to upgrade from version A to version C and there is
version B between A and C, you need to follow the instructions version B between A and C, you need to follow the instructions
for both A and B. for both A and B.
Upgrade from Yii 2.0.36
-----------------------
* `yii\db\Exception::getCode()` now returns full PDO code that is SQLSTATE strin
g. If you have relied on comparing code
with an integer value, adjust your code.
Upgrade from Yii 2.0.35 Upgrade from Yii 2.0.35
----------------------- -----------------------
* Inline validator signature has been updated with 4th parameter `current`: * Inline validator signature has been updated with 4th parameter `current`:
```php ```php
/** /**
* @param mixed $current the currently validated value of attribute * @param mixed $current the currently validated value of attribute
*/ */
function ($attribute, $params, $validator, $current) function ($attribute, $params, $validator, $current)
skipping to change at line 94 skipping to change at line 100
// previously: // previously:
// $this->$attribute === 'first' (on first iteration) // $this->$attribute === 'first' (on first iteration)
// $this->$attribute === 'second' (on second iteration) // $this->$attribute === 'second' (on second iteration)
// use now $current instead // use now $current instead
// $current === 'first' (on first iteration) // $current === 'first' (on first iteration)
// $current === 'second' (on second iteration) // $current === 'second' (on second iteration)
} }
``` ```
* `$this` in an inline validator defined as closure now refers to model instance
. If you need to access the object registering
the validator, pass its instance through use statement:
```php
$registrar = $this;
$validator = function($attribute, $params, $validator, $current) use ($registr
ar) {
// ...
}
```
* If you have any controllers that override the `init()` method, make sure they are calling `parent::init()` at * If you have any controllers that override the `init()` method, make sure they are calling `parent::init()` at
the beginning, as demonstrated in the [component guide](https://www.yiiframewo rk.com/doc/guide/2.0/en/concept-components). the beginning, as demonstrated in the [component guide](https://www.yiiframewo rk.com/doc/guide/2.0/en/concept-components).
Upgrade from Yii 2.0.34
-----------------------
* `ExistValidator` used as a rule of `EachValidator` now requires providing `tar
getClass` explicitely and it's not possible to use it with `targetRelation` in
that configuration.
```php
public function rules()
{
return [
['attribute', 'each', 'rule' => ['exist', 'targetClass' => static::cla
ssName(), 'targetAttribute' => 'id']],
];
}
```
Upgrade from Yii 2.0.32 Upgrade from Yii 2.0.32
----------------------- -----------------------
* `yii\helpers\ArrayHelper::filter` now correctly filters data when passing a fi lter with more than 2 "levels", * `yii\helpers\ArrayHelper::filter` now correctly filters data when passing a fi lter with more than 2 "levels",
e.g. `ArrayHelper::filter($myArray, ['A.B.C']`. Until Yii 2.0.32 all data afte r the 2nd level was returned, e.g. `ArrayHelper::filter($myArray, ['A.B.C']`. Until Yii 2.0.32 all data afte r the 2nd level was returned,
please see the following example: please see the following example:
```php ```php
$myArray = [ $myArray = [
'A' => 1, 'A' => 1,
 End of changes. 3 change blocks. 
0 lines changed or deleted 36 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)