Create new model from the same base class
as $this.
public newInstance ( string $class = null, array $options = [] ) : |
||
$class | string | |
$options | array | |
return |
public function testCustomRef() { $a = []; $p = new \atk4\data\Persistence_Array($a); $m = new Model($p, ['table' => 'user']); $m->addRef('archive', function ($m) { return $m->newInstance(null, ['table' => $m->table . '_archive']); }); $this->assertEquals('user_archive', $m->ref('archive')->table); }