Ejemplo n.º 1
0
 public function setUp()
 {
     $this->persistEvent = $this->prophesize(PersistEvent::class);
     $this->hydrateEvent = $this->prophesize(HydrateEvent::class);
     $this->notImplementing = new \stdClass();
     $this->encoder = $this->prophesize(PropertyEncoder::class);
     $this->node = $this->prophesize(NodeInterface::class);
     $this->accessor = $this->prophesize(DocumentAccessor::class);
     $this->persistEvent->getNode()->willReturn($this->node);
     $this->persistEvent->getAccessor()->willReturn($this->accessor);
     $this->hydrateEvent->getAccessor()->willReturn($this->accessor);
 }
Ejemplo n.º 2
0
 /**
  * @param HydrateEvent $event
  */
 public function handleHydrate(HydrateEvent $event)
 {
     $document = $event->getDocument();
     if (!$document instanceof PathBehavior) {
         return;
     }
     $event->getAccessor()->set('path', $this->documentInspector->getPath($document));
 }
 /**
  * @param HydrateEvent $event
  */
 public function handleHydrate(HydrateEvent $event)
 {
     $document = $event->getDocument();
     if (!$document instanceof ChildrenBehavior) {
         return;
     }
     $accessor = $event->getAccessor();
     $accessor->set('children', $this->proxyFactory->createChildrenCollection($document, $event->getOptions()));
 }
 /**
  * @param HydrateEvent $event
  */
 public function handleHydrate(HydrateEvent $event)
 {
     $document = $event->getDocument();
     if (!$document instanceof TimestampBehavior) {
         return;
     }
     $node = $event->getNode();
     $locale = $event->getLocale();
     $accessor = $event->getAccessor();
     $accessor->set(self::CREATED, $node->getPropertyValueWithDefault($v = $this->encoder->localizedSystemName(self::CREATED, $locale), null));
     $accessor->set(self::CHANGED, $node->getPropertyValueWithDefault($this->encoder->localizedSystemName(self::CHANGED, $locale), null));
 }