public function onPostSerialize(ObjectEvent $event)
 {
     $embeds = $this->embedsFactory->create($event->getObject(), $event->getContext());
     $links = $this->linksFactory->createLinks($event->getObject(), $event->getContext());
     if (count($links) > 0) {
         $this->xmlSerializer->serializeLinks($links, $event->getVisitor());
     }
     if (count($embeds) > 0) {
         $this->xmlSerializer->serializeEmbedded($embeds, $event->getVisitor(), $event->getContext());
     }
 }
 public function onPostSerialize(ObjectEvent $event)
 {
     $object = $event->getObject();
     $context = $event->getContext();
     $context->startVisiting($object);
     $embeddeds = $this->embeddedsFactory->create($object, $context);
     $links = $this->linksFactory->create($object, $context);
     if (count($links) > 0) {
         $this->xmlSerializer->serializeLinks($links, $event->getVisitor(), $context);
     }
     if (count($embeddeds) > 0) {
         $this->xmlSerializer->serializeEmbeddeds($embeddeds, $event->getVisitor(), $context);
     }
     $context->stopVisiting($object);
 }