for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Chubbyphp\Model\Reference;
use Chubbyphp\Model\ModelInterface;
final class ModelReference implements ModelReferenceInterface
{
/**
* @var ModelInterface|null
*/
private $initialModel;
private $model;
* @param ModelInterface|null $model
public function __construct(ModelInterface $model = null)
$this->initialModel = $model;
$this->model = $model;
}
public function setModel(ModelInterface $model = null): ModelReferenceInterface
return $this;
* @return ModelInterface|null
public function getModel()
return $this->model;
* @return null|string
public function getId()
if (null === $this->model) {
return null;
return $this->model->getId();
public function getInitialModel()
return $this->initialModel;
* @return array|null
public function jsonSerialize()
return $this->model->jsonSerialize();