Commit 9aa006e5 by Qiang Xue

Removed implementation of `Arrayable` from `yii\Object`

parent 48448864
...@@ -113,6 +113,7 @@ Yii Framework 2 Change Log ...@@ -113,6 +113,7 @@ Yii Framework 2 Change Log
`index-test.php` and `yii` files to point to the new location of `Yii.php` (qiangxue, cebe) `index-test.php` and `yii` files to point to the new location of `Yii.php` (qiangxue, cebe)
- Chg: Advanced app template: moved database connection DSN, login and password to `-local` config not to expose it to VCS (samdark) - Chg: Advanced app template: moved database connection DSN, login and password to `-local` config not to expose it to VCS (samdark)
- Chg: Renamed `yii\web\Request::acceptedLanguages` to `acceptableLanguages` (qiangxue) - Chg: Renamed `yii\web\Request::acceptedLanguages` to `acceptableLanguages` (qiangxue)
- Chg: Removed implementation of `Arrayable` from `yii\Object` (qiangxue)
- New #66: [Auth client library](https://github.com/yiisoft/yii2-authclient) OpenId, OAuth1, OAuth2 clients (klimov-paul) - New #66: [Auth client library](https://github.com/yiisoft/yii2-authclient) OpenId, OAuth1, OAuth2 clients (klimov-paul)
- New #1393: [Codeception testing framework integration](https://github.com/yiisoft/yii2-codeception) (Ragazzo) - New #1393: [Codeception testing framework integration](https://github.com/yiisoft/yii2-codeception) (Ragazzo)
- New #1438: [MongoDB integration](https://github.com/yiisoft/yii2-mongodb) ActiveRecord and Query (klimov-paul) - New #1438: [MongoDB integration](https://github.com/yiisoft/yii2-mongodb) ActiveRecord and Query (klimov-paul)
......
...@@ -52,7 +52,7 @@ use yii\validators\Validator; ...@@ -52,7 +52,7 @@ use yii\validators\Validator;
* @author Qiang Xue <qiang.xue@gmail.com> * @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0 * @since 2.0
*/ */
class Model extends Component implements IteratorAggregate, ArrayAccess class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayable
{ {
/** /**
* The name of the default scenario. * The name of the default scenario.
......
...@@ -17,7 +17,7 @@ use Yii; ...@@ -17,7 +17,7 @@ use Yii;
* @author Qiang Xue <qiang.xue@gmail.com> * @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0 * @since 2.0
*/ */
class Object implements Arrayable class Object
{ {
/** /**
* @return string the fully qualified name of this class. * @return string the fully qualified name of this class.
...@@ -227,14 +227,4 @@ class Object implements Arrayable ...@@ -227,14 +227,4 @@ class Object implements Arrayable
{ {
return method_exists($this, $name); return method_exists($this, $name);
} }
/**
* Converts the object into an array.
* The default implementation will return all public property values as an array.
* @return array the array representation of the object
*/
public function toArray()
{
return Yii::getObjectVars($this);
}
} }
...@@ -9,6 +9,7 @@ namespace yii\web; ...@@ -9,6 +9,7 @@ namespace yii\web;
use Yii; use Yii;
use ArrayIterator; use ArrayIterator;
use yii\base\Arrayable;
use yii\base\InvalidCallException; use yii\base\InvalidCallException;
use yii\base\Object; use yii\base\Object;
...@@ -22,7 +23,7 @@ use yii\base\Object; ...@@ -22,7 +23,7 @@ use yii\base\Object;
* @author Qiang Xue <qiang.xue@gmail.com> * @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0 * @since 2.0
*/ */
class CookieCollection extends Object implements \IteratorAggregate, \ArrayAccess, \Countable class CookieCollection extends Object implements \IteratorAggregate, \ArrayAccess, \Countable, Arrayable
{ {
/** /**
* @var boolean whether this collection is read only. * @var boolean whether this collection is read only.
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace yii\web; namespace yii\web;
use Yii; use Yii;
use yii\base\Arrayable;
use yii\base\Object; use yii\base\Object;
use ArrayIterator; use ArrayIterator;
...@@ -21,7 +22,7 @@ use ArrayIterator; ...@@ -21,7 +22,7 @@ use ArrayIterator;
* @author Qiang Xue <qiang.xue@gmail.com> * @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0 * @since 2.0
*/ */
class HeaderCollection extends Object implements \IteratorAggregate, \ArrayAccess, \Countable class HeaderCollection extends Object implements \IteratorAggregate, \ArrayAccess, \Countable, Arrayable
{ {
/** /**
* @var array the headers in this collection (indexed by the header names) * @var array the headers in this collection (indexed by the header names)
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace yii\web; namespace yii\web;
use Yii; use Yii;
use yii\base\Arrayable;
use yii\base\Component; use yii\base\Component;
use yii\base\InvalidConfigException; use yii\base\InvalidConfigException;
use yii\base\InvalidParamException; use yii\base\InvalidParamException;
...@@ -71,7 +72,7 @@ use yii\base\InvalidParamException; ...@@ -71,7 +72,7 @@ use yii\base\InvalidParamException;
* @author Qiang Xue <qiang.xue@gmail.com> * @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0 * @since 2.0
*/ */
class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Countable class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Countable, Arrayable
{ {
/** /**
* @var boolean whether the session should be automatically started when the session component is initialized. * @var boolean whether the session should be automatically started when the session component is initialized.
......
...@@ -239,7 +239,6 @@ class FileValidatorTest extends TestCase ...@@ -239,7 +239,6 @@ class FileValidatorTest extends TestCase
$val->validateAttribute($m, 'attr_err_part'); $val->validateAttribute($m, 'attr_err_part');
$this->assertTrue($m->hasErrors('attr_err_part')); $this->assertTrue($m->hasErrors('attr_err_part'));
$this->assertSame(Yii::t('yii', 'File upload failed.'), current($m->getErrors('attr_err_part'))); $this->assertSame(Yii::t('yii', 'File upload failed.'), current($m->getErrors('attr_err_part')));
$log = Yii::$app->getLog()->toArray();
} }
public function testValidateAttributeErrCantWrite() public function testValidateAttributeErrCantWrite()
...@@ -249,7 +248,6 @@ class FileValidatorTest extends TestCase ...@@ -249,7 +248,6 @@ class FileValidatorTest extends TestCase
$val->validateAttribute($m, 'attr_err_write'); $val->validateAttribute($m, 'attr_err_write');
$this->assertTrue($m->hasErrors('attr_err_write')); $this->assertTrue($m->hasErrors('attr_err_write'));
$this->assertSame(Yii::t('yii', 'File upload failed.'), current($m->getErrors('attr_err_write'))); $this->assertSame(Yii::t('yii', 'File upload failed.'), current($m->getErrors('attr_err_write')));
$log = Yii::$app->getLog()->toArray();
} }
public function testValidateAttributeErrExtension() public function testValidateAttributeErrExtension()
...@@ -259,7 +257,6 @@ class FileValidatorTest extends TestCase ...@@ -259,7 +257,6 @@ class FileValidatorTest extends TestCase
$val->validateAttribute($m, 'attr_err_ext'); $val->validateAttribute($m, 'attr_err_ext');
$this->assertTrue($m->hasErrors('attr_err_ext')); $this->assertTrue($m->hasErrors('attr_err_ext'));
$this->assertSame(Yii::t('yii', 'File upload failed.'), current($m->getErrors('attr_err_ext'))); $this->assertSame(Yii::t('yii', 'File upload failed.'), current($m->getErrors('attr_err_ext')));
$log = Yii::$app->getLog()->toArray();
} }
public function testValidateAttributeErrNoTmpDir() public function testValidateAttributeErrNoTmpDir()
...@@ -269,6 +266,5 @@ class FileValidatorTest extends TestCase ...@@ -269,6 +266,5 @@ class FileValidatorTest extends TestCase
$val->validateAttribute($m, 'attr_err_tmp'); $val->validateAttribute($m, 'attr_err_tmp');
$this->assertTrue($m->hasErrors('attr_err_tmp')); $this->assertTrue($m->hasErrors('attr_err_tmp'));
$this->assertSame(Yii::t('yii', 'File upload failed.'), current($m->getErrors('attr_err_tmp'))); $this->assertSame(Yii::t('yii', 'File upload failed.'), current($m->getErrors('attr_err_tmp')));
$log = Yii::$app->getLog()->toArray();
} }
} }
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