public function prepare($node, $row) { // Fetch and prepare the variables field. $node->field_project_roles[LANGUAGE_NONE] = $this->getProjectRoles($node, $row); // Remove any empty or illegal delta field values. EntityHelper::removeInvalidFieldDeltas('node', $node); EntityHelper::removeEmptyFieldValues('node', $node); }
public function prepare($node, $row) { // Fetch and prepare the variables field. $node->field_variables[LANGUAGE_NONE] = $this->getVariables($node, $row); // Remove any empty or illegal delta field values. EntityHelper::removeInvalidFieldDeltas('node', $node); EntityHelper::removeEmptyFieldValues('node', $node); // Perform field validation and check for debugging information. if (empty($node->field_variables[LANGUAGE_NONE])) { $this->saveMessage('Empty variable field in data file node.', MigrationBase::MESSAGE_INFORMATIONAL); } }
/** * @param string $methodName * @param array $args */ public function __call($methodName, array $args) { if (isset(static::$entityClassNames[$methodName])) { $className = static::$entityClassNames[$methodName]; $repository = EntityHelper::getRepository($className); $entities = array(); $ids = $args[0]; foreach ($ids as $id) { $id = EntityHelper::parseCombinedId($className, $id); $entities[] = $repository->find($id); } return $entities; } throw new \RuntimeException('No save options resolver class found for ' . $methodName); }
/** * 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; }
/** * @param IEntity * @return string * @see EntityHelper::toString() */ public static function e(IEntity $entity) { return EntityHelper::toString($entity); }
/** * 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; }
public static function compareByPublishingDateDesc(\Sb\Db\Model\Book $book1, \Sb\Db\Model\Book $book2) { return EntityHelper::compareBy($book1, $book2, EntityHelper::DESC, "getPublishingDate"); }