示例#1
0
 private function serialize(VisitorInterface $visitor, $data, Type $type, Context $context)
 {
     if ($visitor instanceof XmlSerializationVisitor && false === $this->xmlCData) {
         return $visitor->visitSimpleString($data);
     }
     return $visitor->visitString($data, $type, $context);
 }
示例#2
0
 private function visit(VisitorInterface $visitor, Context $context, $data, $format, Type $type = null)
 {
     $data = $visitor->prepare($data);
     $context->initialize($format, $visitor, $this->navigator, $this->factory);
     $visitor->setNavigator($this->navigator);
     $this->navigator->accept($data, $type, $context);
     return $visitor->getResult();
 }
示例#3
0
 private function visitArray(VisitorInterface $visitor, $data, Type $type, $context)
 {
     if ($context instanceof SerializationContext && $type->hasParam(0) && !$type->hasParam(1)) {
         $data = array_values($data);
     }
     return $visitor->visitArray($data, $type, $context);
 }
 public function deserializeCollection(VisitorInterface $visitor, $data, Type $type, Context $context)
 {
     return new ArrayCollection($visitor->visitArray($data, $type, $context));
 }
 public function serializeViolation(VisitorInterface $visitor, ConstraintViolation $violation, Type $type, Context $context)
 {
     $serializableViolation = new SerializableConstraintViolation($violation);
     $metadata = $context->getMetadataFactory()->getMetadataFor($serializableViolation);
     return $visitor->visitObject($metadata, $serializableViolation, $type, $context);
 }
 public function deserializeSequence(VisitorInterface $visitor, $data, Type $type, Context $context)
 {
     return new Sequence($visitor->visitArray($data, $type, $context));
 }
 public function deserializeCollection(VisitorInterface $visitor, $data, Type $type, Context $context)
 {
     $collection = new \PropelCollection();
     $collection->setData($visitor->visitArray($data, $type, $context));
     return $collection;
 }
示例#8
0
 public function serializeFormError(VisitorInterface $visitor, FormError $formError, Type $type, Context $context)
 {
     return $visitor->visitString($this->getErrorMessage($formError), $type, $context);
 }