mirror of
https://github.com/yiisoft/yii2.git
synced 2026-03-21 14:37:21 +01:00
- #13779: Fixed `yii\db\ActiveRecord::joinWith()` unable to use relation defined via attached behavior. - #5786: Allowed to use custom constructors in ActiveRecord-based classes.
33 lines
645 B
PHP
33 lines
645 B
PHP
<?php
|
|
|
|
namespace yiiunit\data\ar;
|
|
|
|
/**
|
|
* ProfileWithConstructor
|
|
*
|
|
* @property int $id
|
|
* @property string $description
|
|
*/
|
|
class ProfileWithConstructor extends ActiveRecord
|
|
{
|
|
public static function tableName()
|
|
{
|
|
return 'profile';
|
|
}
|
|
|
|
public function __construct($description)
|
|
{
|
|
$this->description = $description;
|
|
parent::__construct();
|
|
}
|
|
|
|
public static function instance($refresh = false)
|
|
{
|
|
return self::instantiate([]);
|
|
}
|
|
|
|
public static function instantiate($row)
|
|
{
|
|
return (new \ReflectionClass(static::className()))->newInstanceWithoutConstructor();
|
|
}
|
|
} |