コード例 #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);
 }
コード例 #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));
 }
コード例 #3
0
 /**
  * @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()));
 }
コード例 #4
0
 /**
  * @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));
 }