/** * @param string $name * @param mixed $value * @param User $user */ public function __construct($name, $value, UserPreferencesCollection $collection) { parent::__construct(); $this->name = $name; $this->value = $value; $this->collection = $collection; }
/** * @param string $name * @param BlockProperty $blockProperty * @param null|ReferencedElementAbstract $referencedElement */ public function __construct($name, BlockProperty $blockProperty, ReferencedElementAbstract $referencedElement = null) { parent::__construct(); $this->name = $name; $this->blockProperty = $blockProperty; $this->referencedElement = $referencedElement; }
/** * @param string $name * @param Abstraction\File $file */ public function __construct($name, Abstraction\File $file) { parent::__construct(); $this->name = $name; $this->file = $file; }
/** * Collects array of ID keys * @return int[] */ public function collectIds() { //TODO: check if all elements are entities $ids = Entity::collectIds($this); return $ids; }
/** * Need to unset the nested set node after clone */ public function __clone() { parent::__clone(); if (!empty($this->id)) { $this->nestedSetNode = $this->left = $this->right = $this->level = null; } }
/** * @param Entity $entity1 * @param Entity $entity2 * @return bool */ public static function areEqual(Entity $entity1 = null, Entity $entity2 = null) { if ($entity1 === $entity2) { return true; } if ($entity1 instanceof Entity || $entity2 instanceof Entity) { return false; } $equals = $entity1->equals($entity2); return $equals; }
/** * @param Localization $localization * @return array */ private function getLocalizationData(Localization $localization) { $page = $localization->getMaster(); $allLocalizationData = array(); foreach ($page->getLocalizations() as $locale => $pageLocalization) { $allLocalizationData[$locale] = $pageLocalization->getId(); } $ancestorIds = Entity::collectIds($localization->getAncestors()); // abstract localization data $localizationData = array('root' => $page->isRoot(), 'tree_path' => $ancestorIds, 'locale' => $localization->getLocaleId(), 'localizations' => $allLocalizationData, 'lock' => $this->getLocalizationEditLockData($localization), 'is_visible_in_menu' => $localization->isVisibleInMenu(), 'is_visible_in_sitemap' => $localization->isVisibleInSitemap(), 'include_in_search' => $localization->isIncludedInSearch(), 'page_change_frequency' => $localization->getChangeFrequency(), 'page_priority' => $localization->getPagePriority(), 'internal_html' => null, 'contents' => array()); if ($localization instanceof PageLocalization) { $creationTime = $localization->getCreationTime(); $publicationSchedule = $localization->getScheduleTime(); $localizationData = array_replace($localizationData, array('keywords' => $localization->getMetaKeywords(), 'description' => $localization->getMetaDescription(), 'created_date' => $creationTime->format('Y-m-d'), 'created_time' => $creationTime->format('H:i:s'), 'scheduled_date' => $publicationSchedule ? $publicationSchedule->format('Y-m-d') : null, 'scheduled_time' => $publicationSchedule ? $publicationSchedule->format('H:i:s') : null, 'active' => $localization->isActive(), 'template' => array('id' => $localization->getTemplate()->getId(), 'title' => $localization->getTemplateLocalization()->getTitle()))); } elseif ($localization instanceof TemplateLocalization) { $layoutData = null; if ($page->hasLayout($this->getMedia())) { $layoutName = $page->getLayoutName($this->getMedia()); $layout = $this->getActiveTheme()->getLayout($layoutName); if ($layout !== null) { $layoutData = array('id' => $layout->getName(), 'title' => $layout->getTitle()); } } $localizationData = array_replace($localizationData, array('layouts' => $this->getActiveThemeLayoutsData(), 'layout' => $layoutData)); } return array_replace($this->loadNodeMainData($localization), $localizationData); }
/** * @param string $name */ public function __construct($name) { parent::__construct(); $this->name = (string) $name; $this->metadata = new ArrayCollection(); $this->properties = new ArrayCollection(); }
/** * Create block properties collection */ public function __construct() { parent::__construct(); $this->blockProperties = new ArrayCollection(); }
/** * @param string $localeId */ public function __construct($localeId) { parent::__construct(); $this->locale = $localeId; $this->blockProperties = new ArrayCollection(); $this->placeHolders = new ArrayCollection(); $this->tags = new ArrayCollection(); }
/** * @param DeepCopy $deepCopy * @param EntityManager $entityManager * @return DeepCopy */ private function addDeepCopyCommonFilters(DeepCopy $deepCopy, EntityManager $entityManager) { $keepFilter = new KeepFilter(); $nullifyFilter = new SetNullFilter(); // Matches RedirectTargetPage::$page property. // Keeps the $page property redirect target is referencing to. $deepCopy->addFilter($keepFilter, new PropertyMatcher(RedirectTargetPage::CN(), 'page')); // Matches PageLocalization::$template. // Prevents the template to be cloned. $deepCopy->addFilter($keepFilter, new PropertyMatcher(PageLocalization::CN(), 'template')); // Matches Localization::$path // Keeps the value since it is cloned manually (see PageLocalization::__clone()); $deepCopy->addFilter($keepFilter, new PropertyMatcher(Localization::CN(), 'path')); // Matches Block::$blockProperties collection. // Replaces with empty collection, since block properties can be obtained via Localization::$blockProperties. $deepCopy->addFilter(new DoctrineEmptyCollectionFilter(), new PropertyMatcher(Block::CN(), 'blockProperties')); // Matches Localization::$lock. // Nullifies editing lock entity. $deepCopy->addFilter($nullifyFilter, new PropertyMatcher(Localization::CN(), 'lock')); // Matches Localization::$publishedRevision. $deepCopy->addFilter($nullifyFilter, new PropertyMatcher(Localization::CN(), 'publishedRevision')); // Matches Localization::$publishTime. $deepCopy->addFilter($nullifyFilter, new PropertyMatcher(Localization::CN(), 'publishTime')); // Matches Entity Collection. // Creates Copy and persists the elements in it. $deepCopy->addFilter(new DoctrineCollectionFilter($entityManager), new PropertyTypeMatcher('Doctrine\\Common\\Collections\\Collection')); // Matches any Entity. // Creates copy and persists it. $deepCopy->addFilter(new DoctrineEntityFilter($entityManager), new PropertyTypeMatcher(Entity::CN())); }
/** * */ public function __construct() { parent::__construct(); $this->preferences = new Collections\ArrayCollection(); }