/** * @param AbstractMappingEvent $event * * @throws DocumentManagerException */ public function handleLocale(AbstractMappingEvent $event) { $document = $event->getDocument(); if (!$document instanceof LocaleBehavior) { return; } $event->getAccessor()->set('locale', $this->registry->getLocaleForDocument($document)); }
/** * @param AbstractMappingEvent $event */ public function handleWebspace(AbstractMappingEvent $event) { $document = $event->getDocument(); if (!$document instanceof WebspaceBehavior) { return; } $webspaceName = $this->inspector->getWebspace($document); $event->getAccessor()->set('webspaceName', $webspaceName); }
/** * @param AbstractMappingEvent $event * * @throws DocumentManagerException */ public function handleNodeName(AbstractMappingEvent $event) { $document = $event->getDocument(); if (!$document instanceof NodeNameBehavior) { return; } $node = $event->getNode(); $accessor = $event->getAccessor(); $accessor->set('nodeName', $node->getName()); }
/** * @param AbstractMappingEvent $event * * @throws DocumentManagerException */ public function handleUuid(AbstractMappingEvent $event) { $document = $event->getDocument(); if (!$document instanceof UuidBehavior) { return; } $node = $event->getNode(); $accessor = $event->getAccessor(); $accessor->set('uuid', $node->getIdentifier()); }
/** * Adds the order to the document. * * @param AbstractMappingEvent $event */ public function handleHydrate(AbstractMappingEvent $event) { if (false == $this->supports($event->getDocument())) { return; } $node = $event->getNode(); $order = $node->getPropertyValueWithDefault($this->encoder->systemName(self::FIELD), null); $event->getAccessor()->set('suluOrder', $order); }
/** * @param AbstractMappingEvent|HydrateEvent $event * * @throws \Sulu\Component\DocumentManager\Exception\DocumentManagerException */ public function doHydrate(AbstractMappingEvent $event) { $document = $event->getDocument(); $webspaceName = $this->inspector->getWebspace($document); $event->getAccessor()->set('webspaceName', $webspaceName); }
/** * {@inheritdoc} */ public function handleHydrate(AbstractMappingEvent $event) { $document = $event->getDocument(); if (!$this->supportsBehavior($document)) { return; } $node = $event->getNode(); $propertyName = $this->getStructureTypePropertyName($document, $event->getLocale()); $structureType = $node->getPropertyValueWithDefault($propertyName, null); $rehydrate = $event->getOption('rehydrate'); if (!$structureType && $rehydrate) { $structureType = $this->getDefaultStructureType($document); } $document->setStructureType($structureType); if (false === $event->getOption('load_ghost_content', false)) { if ($this->inspector->getLocalizationState($document) === LocalizationState::GHOST) { $structureType = null; } } $container = $this->getStructure($document, $structureType, $rehydrate); // Set the property container $event->getAccessor()->set('structure', $container); }
/** * {@inheritdoc} */ public function handleHydrate(AbstractMappingEvent $event) { $document = $event->getDocument(); if (!$document instanceof StructureBehavior) { return; } $node = $event->getNode(); $propertyName = $this->getStructureTypePropertyName($document, $event->getLocale()); $value = $node->getPropertyValueWithDefault($propertyName, null); $document->setStructureType($value); if (false === $event->getOption('load_ghost_content', false)) { if ($this->inspector->getLocalizationState($document) === LocalizationState::GHOST) { $value = null; } } if ($value) { $container = $this->createStructure($document); } else { $container = new Structure(); } // Set the property container $event->getAccessor()->set('structure', $container); }
/** * @param AbstractMappingEvent $event * * @throws DocumentManagerException */ public function handleHydrate(AbstractMappingEvent $event) { $document = $event->getDocument(); if (!$document instanceof BlameBehavior) { return; } $node = $event->getNode(); $locale = $event->getLocale(); $accessor = $event->getAccessor(); $accessor->set(self::CREATOR, $this->getCreator($node, $locale)); $accessor->set(self::CHANGER, $node->getPropertyValueWithDefault($this->encoder->localizedSystemName(self::CHANGER, $locale), null)); }