Files
oficial/app/common/Ideal/Model.php
2023-08-08 23:53:49 -04:00

30 lines
583 B
PHP

<?php
namespace Incoviba\Common\Ideal;
use Incoviba\Common\Define;
abstract class Model implements Define\Model
{
public int $id;
protected array $factories;
public function addFactory(string $property, Define\Repository\Factory $factory): Model
{
$this->factories[$property] = $factory;
return $this;
}
protected function runFactory(string $property): mixed
{
return $this->factories[$property]->run();
}
public function jsonSerialize(): mixed
{
return [
'id' => $this->id
];
}
}