Код: Выделить всё
public function signup()
{
if (!$this->validate()) {
return null;
}
$user = new User($this->username, $this->password, $this->email);
return $user->save() ? $user : null;
}
Конструктор:
Код: Выделить всё
public function __construct( string $username, string $password, string $email )
{
$this->username = $username;
$this->email = $email;
$this->setPassword($password);
$this->created_at = time();
$this->status = self::STATUS_ACTIVE;
$this->generateAuthKey();
parent::__construct();
}
Код: Выделить всё
namespace common\entities;
trait InstantiateTrait
{
private static $_prototype;
public static function instantiate($row)
{
if (self::$_prototype === null){
$class = get_called_class();
self::$_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($class), $class));
}
$entity = clone self::$_prototype;
$entity->init();
return $entity;
}
}
текст: Too few arguments to function common\entities\User::__construct(), 0 passed in /app/vendor/yiisoft/yii2-debug/models/search/User.php on line 34 and exactly 3 expected
Как решить эту проблему ?