public function setModel(IModel $model) { if ($this->model && $this->model !== $model) { throw new InvalidStateException('Repository is already attached.'); } $this->model = $model; $this->metadataStorage = $model->getMetadataStorage(); }
public function setModel(Nextras\Orm\Model\IModel $model) { parent::setModel($model); if ($model instanceof Model) { $this->onAfterPersist[] = $this->onBeforeRemove[] = [$model, 'processEntityCache']; } }