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; }
/** * @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; }