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); }
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(); }
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; }
public function serializeFormError(VisitorInterface $visitor, FormError $formError, Type $type, Context $context) { return $visitor->visitString($this->getErrorMessage($formError), $type, $context); }