21 lines
342 B
PHP
21 lines
342 B
PHP
|
|
<?php
|
||
|
|
namespace admin\components;
|
||
|
|
|
||
|
|
use yii\db\ActiveRecord;
|
||
|
|
|
||
|
|
class ModelAgent
|
||
|
|
{
|
||
|
|
public $model;
|
||
|
|
|
||
|
|
public function __construct(ActiveRecord $model)
|
||
|
|
{
|
||
|
|
$this->model = $model;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function __call($method, $arguments)
|
||
|
|
{
|
||
|
|
$this->model = $this->model->$method(...$arguments);
|
||
|
|
return $this;
|
||
|
|
}
|
||
|
|
}
|