/** * {@inheritdoc} */ public function setRepository(Repository $repository) { $repository->on('model', $this); foreach ($this->getRelations() as $relation) { $repository->on('relation', $relation); } $this->_repository = $repository; return $this; }