There is such a construction:
Class foo{ public $name; function someName() { $model = new foo; $model->name = 'Vasia'; if($this->name != 'Vasia) $this = $model; // В этой сроке и нужно присвоить свойства return $this; } } You need to assign all the values of the $model properties to $this , so that you do not explicitly write $this->name = $model->name; for each property $this->name = $model->name;
$modelfrom$thisand not vice versa? - Dmitriy Simushev