/** * Test if exception is thrown when Document is used as embeddable. * * @expectedException \LogicException * @expectedExceptionMessage should have @Object or @Nested annotation */ public function testGetDocumentTypeException() { $container = $this->createClient()->getContainer(); $reader = new AnnotationReader(); $finder = new DocumentFinder($container->getParameter('kernel.bundles')); $parser = new DocumentParser($reader, $finder); $parser->parse(new \ReflectionClass(__NAMESPACE__ . '\\InvalidDocument')); }
/** * Gathers annotation data from class. * * @param \ReflectionClass $reflectionClass Document reflection class to read mapping from. * * @return array|null */ private function getDocumentReflectionMapping(\ReflectionClass $reflectionClass) { $mapping = $this->parser->parse($reflectionClass); if ($mapping !== null) { $type = key($mapping); $this->proxyPaths[$mapping[$type]['proxyNamespace']] = $this->proxyLoader->load($reflectionClass); foreach ($mapping[$type]['objects'] as $namespace) { $objectReflection = new \ReflectionClass($namespace); $proxyObject = ProxyFactory::getProxyNamespace($objectReflection); if (!array_key_exists($proxyObject, $this->proxyPaths)) { $this->proxyPaths[$proxyObject] = $this->proxyLoader->load($objectReflection); } } } return $mapping; }
/** * Gathers annotation data from class. * * @param \ReflectionClass $reflectionClass Document reflection class to read mapping from. * * @return array * @throws DocumentParserException */ private function getDocumentReflectionMapping(\ReflectionClass $reflectionClass) { return $this->parser->parse($reflectionClass); }