From 44950ddb7777cc63155307adf5a03b812b4f1745 Mon Sep 17 00:00:00 2001 From: Johannes Schmitt Date: Tue, 17 May 2011 07:16:50 +0200 Subject: [PATCH] updated to latest changes --- .../DoctrineBundle/Annotations/Reader.php | 67 +++++++++++++++++++ .../DoctrineBundle/Resources/config/orm.xml | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Bundle/DoctrineBundle/Annotations/Reader.php diff --git a/src/Symfony/Bundle/DoctrineBundle/Annotations/Reader.php b/src/Symfony/Bundle/DoctrineBundle/Annotations/Reader.php new file mode 100644 index 0000000000..118fa19016 --- /dev/null +++ b/src/Symfony/Bundle/DoctrineBundle/Annotations/Reader.php @@ -0,0 +1,67 @@ + + */ +class Reader implements ReaderInterface +{ + private $delegate; + + public function __construct(ReaderInterface $reader) + { + $this->delegate = $reader; + } + + public function getClassAnnotations(\ReflectionClass $class) + { + $annotations = array(); + foreach ($this->delegate->getClassAnnotations($class) as $annot) { + $annotations[get_class($annot)] = $annot; + } + + return $annotations; + } + + public function getClassAnnotation(\ReflectionClass $class, $annotation) + { + return $this->delegate->getClassAnnotation($class, $annotation); + } + + public function getMethodAnnotations(\ReflectionMethod $method) + { + $annotations = array(); + foreach ($this->delegate->getMethodAnnotations($method) as $annot) { + $annotations[get_class($annot)] = $annot; + } + + return $annotations; + } + + public function getMethodAnnotation(\ReflectionMethod $method, $annotation) + { + return $this->delegate->getMethodAnnotation($method, $annotation); + } + + public function getPropertyAnnotations(\ReflectionProperty $property) + { + $annotations = array(); + foreach ($this->delegate->getPropertyAnnotations($property) as $annot) { + $annotations[get_class($annot)] = $annot; + } + + return $annotations; + } + + public function getPropertyAnnotation(\ReflectionProperty $property, $annotation) + { + return $this->delegate->getPropertyAnnotation($property, $annotation); + } +} \ No newline at end of file diff --git a/src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml b/src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml index 4e121a6802..8cdf112e96 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml +++ b/src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml @@ -20,7 +20,7 @@ Doctrine\ORM\Mapping\Driver\DriverChain Doctrine\ORM\Mapping\Driver\AnnotationDriver - Annotations\DoctrineReader + Symfony\Bundle\DoctrineBundle\Annotations\Reader Symfony\Bundle\DoctrineBundle\Mapping\Driver\XmlDriver Symfony\Bundle\DoctrineBundle\Mapping\Driver\YamlDriver Doctrine\ORM\Mapping\Driver\PHPDriver