/** * @param IEntity * @return string * @see EntityHelper::toString() */ public static function e(IEntity $entity) { return EntityHelper::toString($entity); }
/** * Check if entity is not attached to another repository. * @param IEntity * @param bool * @return bool * @throws InvalidEntityException */ private function checkEntityRepository(IEntity $entity, $throw = true) { $r = $entity->getRepository(false); if ($r and $r !== $this->repository) { if ($throw) { throw new InvalidEntityException(EntityHelper::toString($entity) . ' is attached to another repository.'); } return false; } return true; }
/** * Repository ktery se o tuto entitu stara. * Existuje jen kdyz entita byla persistovana. * @param bool * @return IRepository |NULL * @throws EntityNotAttachedException */ public final function getRepository($need = true) { if (!$this->repository and $need) { throw new EntityNotAttachedException(EntityHelper::toString($this) . ' is not attached to repository.'); } return $this->repository; }