Esempio n. 1
0
 /**
  * @param PreSerializeEvent $event
  */
 public function onPreSerialize(PreSerializeEvent $event)
 {
     $object = $event->getObject();
     if ($object instanceof LazyLoadingInterface) {
         $event->setType(ClassNameInflector::getUserClassName(get_class($object)));
     }
 }
 /**
  * {@inheritdoc}
  */
 public function getMetadataForClass($class)
 {
     $class = ClassNameInflector::getUserClassName($class);
     if (!isset($this->classMap[$class])) {
         throw new MetadataNotFoundException(sprintf('Metadata with class "%s" not found, known classes: "%s"', $class, implode('", "', array_keys($this->classMap))));
     }
     $map = $this->classMap[$class];
     return $this->getMetadata($map);
 }
 /**
  * @param $document
  */
 public function __construct($document)
 {
     $this->document = $document;
     $documentClass = get_class($document);
     if ($document instanceof LazyLoadingInterface) {
         $documentClass = ClassNameInflector::getUserClassName($documentClass);
     }
     $this->reflection = new \ReflectionClass($documentClass);
 }
 public function testInflector()
 {
     $this->assertEquals('Hello', ClassNameInflector::getUserClassName('Hello'));
 }