Files
yii2/tests/data/ar/CustomerWithConstructor.php
Alexander Makarov fb23b0d0ea Code style fixes
2017-11-01 02:43:02 +03:00

51 lines
1.1 KiB
PHP

<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yiiunit\data\ar;
/**
* CustomerWithConstructor.
*
* @property int $id
* @property string $name
* @property string $email
* @property string $address
* @property int $status
*
* @property ProfileWithConstructor $profile
*/
class CustomerWithConstructor extends ActiveRecord
{
public static function tableName()
{
return 'customer';
}
public function __construct($name, $email, $address)
{
$this->name = $name;
$this->email = $email;
$this->address = $address;
parent::__construct();
}
public static function instance($refresh = false)
{
return self::instantiate([]);
}
public static function instantiate($row)
{
return (new \ReflectionClass(static::className()))->newInstanceWithoutConstructor();
}
public function getProfile()
{
return $this->hasOne(ProfileWithConstructor::className(), ['id' => 'profile_id']);
}
}