Commit ff4307be by MDMunir

Merge pull request #2 from yiisoft/master

merge
parents 8f8ec23d bfb39ed8
......@@ -24,6 +24,7 @@ which is the latest stable release of Yii.
[![Code Coverage](https://scrutinizer-ci.com/g/yiisoft/yii2/badges/coverage.png?s=31d80f1036099e9d6a3e4d7738f6b000b3c3d10e)](https://scrutinizer-ci.com/g/yiisoft/yii2/)
[![Dependency Status](https://www.versioneye.com/php/yiisoft:yii2/dev-master/badge.png)](https://www.versioneye.com/php/yiisoft:yii2/dev-master)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/yiisoft/yii2/badges/quality-score.png?s=b1074a1ff6d0b214d54fa5ab7abbb90fc092471d)](https://scrutinizer-ci.com/g/yiisoft/yii2/)
[![Code Climate](https://codeclimate.com/github/yiisoft/yii2.png)](https://codeclimate.com/github/yiisoft/yii2)
DIRECTORY STRUCTURE
-------------------
......
......@@ -447,6 +447,17 @@ as arrays, which can significantly reduce the needed CPU time and memory if larg
$customers = Customer::find()->asArray()->all();
```
Another change is that you can't define attribute default values through public properties anymore.
If you need those, you should set them in the init method of your record class.
```php
public function init()
{
parent::init();
$this->status = self::STATUS_NEW;
}
```
There are many other changes and enhancements to Active Record. Please refer to
the [Active Record](db-active-record.md) section for more details.
......
......@@ -29,6 +29,7 @@ Yii Framework 2 Change Log
- Bug #3436: Fixed the issue that `ServiceLocator` still returns the old component after calling `set()` with a new definition (qiangxue)
- Bug #3458: Fixed the bug that the image rendered by `CaptchaAction` was using a wrong content type (MDMunir, qiangxue)
- Bug #3522: Fixed BaseFileHelper::normalizePath to allow a (.) for the current path. (skotos)
- Bug #3548: Fixed the bug that X-Rate-Limit-Remaining header is always zero when using RateLimiter (qiangxue)
- Bug: Fixed inconsistent return of `\yii\console\Application::runAction()` (samdark)
- Enh #2264: `CookieCollection::has()` will return false for expired or removed cookies (qiangxue)
- Enh #2435: `yii\db\IntegrityException` is now thrown on database integrity errors instead of general `yii\db\Exception` (samdark)
......
......@@ -110,7 +110,7 @@ class RateLimiter extends ActionFilter
throw new TooManyRequestsHttpException($this->errorMessage);
} else {
$user->saveAllowance($request, $action, $allowance - 1, $current);
$this->addRateLimitHeaders($response, $limit, 0, (int) (($limit - $allowance) * $window / $limit));
$this->addRateLimitHeaders($response, $limit, $allowance - 1, (int) (($limit - $allowance) * $window / $limit));
}
}
......
......@@ -293,12 +293,19 @@ EOD;
$expected = <<<EOD
<select name="test" size="4">
<option value="value1&lt;&gt;">text1&lt;&gt;</option>
<option value="value 2">text&nbsp;&nbsp;2</option>
<option value="value 2">text 2</option>
</select>
EOD;
$this->assertEqualsWithoutLE($expected, Html::listBox('test', null, $this->getDataItems2()));
$expected = <<<EOD
<select name="test" size="4">
<option value="value1&lt;&gt;">text1&lt;&gt;</option>
<option value="value 2">text&nbsp;&nbsp;2</option>
</select>
EOD;
$this->assertEqualsWithoutLE($expected, Html::listBox('test', null, $this->getDataItems2(), ['encodeSpaces' => true]));
$expected = <<<EOD
<select name="test" size="4">
<option value="value1">text1</option>
<option value="value2" selected>text2</option>
</select>
......@@ -495,8 +502,20 @@ EOD;
'groups' => [
'group12' => ['class' => 'group'],
],
'encodeSpaces' => true,
];
$this->assertEqualsWithoutLE($expected, Html::renderSelectOptions(['value111', 'value1'], $data, $attributes));
$attributes = [
'prompt' => 'please select<>',
'options' => [
'value111' => ['class' => 'option'],
],
'groups' => [
'group12' => ['class' => 'group'],
],
];
$this->assertEqualsWithoutLE(str_replace('&nbsp;', ' ', $expected), Html::renderSelectOptions(['value111', 'value1'], $data, $attributes));
}
public function testRenderAttributes()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment