public function onModelAttach(IModel $model) { if ($this->model && $this->model !== $model) { throw new InvalidStateException('Repository is already attached.'); } $this->model = $model; $this->metadataStorage = $model->getMetadataStorage(); }
public function __construct(IModel $model, IMapper $mapper) { $this->model = $model; $this->mapper = $mapper; $this->metadataStorage = $model->getMetadataStorage(); }