コード例 #1
0
 private function createSerializer()
 {
     $registry = new SerializerRegistry();
     $serializer = new Serializer(new EventManager());
     $serializer->attach(new ObjectListener(new SerializerLocator($registry, new ObjectSerializerGenerator(new AnnotationBackedPropertyInfo()), new ArrayCache('Serializer'))));
     $serializer->attach(new EncryptionListener(new EncryptorLocator(new EncryptorGenerator(new AnnotationBackedPropertyInfo()), new ArrayCache('Encryptor')), $this->blockCipher));
     return $serializer;
 }
コード例 #2
0
 /**
  * @return Serializer
  */
 public function createSerializer()
 {
     $registry = new SerializerRegistry();
     $registry->add(new DateTimeSerializer());
     $registry->add(new DateTimeImmutableSerializer());
     $serializer = new Serializer(new EventManager());
     $serializer->attach(new ObjectTypeListener());
     $serializer->attach(new ObjectListener(new SerializerLocator($registry, new ObjectSerializerGenerator(new AnnotationBackedPropertyInfo()), new ArrayCache('Serializer'))));
     return $serializer;
 }