public function makeAlive(IEntityFactory $entityFactory = null, Connection $connection = null, IMapper $mapper = null) { $entityFactory === null or $this->setEntityFactory($entityFactory); $mapper === null or $this->useMapper($mapper); $connection === null or $this->row->setConnection($connection); if ($this->entityFactory === null) { throw new InvalidStateException('Missing entity factory in entity ' . get_called_class() . '.'); } if ($this->mapper === null) { throw new InvalidStateException('Missing mapper in entity ' . get_called_class() . '.'); } if (!$this->row->hasConnection()) { throw new InvalidStateException('Missing connection in Result in entity ' . get_called_class() . '.'); } }
/** * @param \LeanMapper\Entity $entity * @param $id * @return void */ public function makeAlive(\LeanMapper\Entity $entity, $id) { \Nette\Utils\Validators::assert($id, 'numericint:1..'); $entity->makeAlive($this->entityFactory, $this->connection, $this->mapper); $entity->attach($id); }