Permalink
Browse files

Added a check to support both the ORM 2.2 and 2.3

  • Loading branch information...
1 parent d294fe4 commit 01ca83002414a8e585108b79632881d7ce21cb36 @stof stof committed Jul 13, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 lib/Gedmo/Mapping/ExtensionMetadataFactory.php
View
11 lib/Gedmo/Mapping/ExtensionMetadataFactory.php
@@ -2,6 +2,7 @@
namespace Gedmo\Mapping;
+use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Common\Persistence\ObjectManager;
use Gedmo\Mapping\Driver\File as FileDriver;
use Gedmo\Mapping\Driver\AnnotationDriverInterface;
@@ -154,8 +155,14 @@ private function getDriver($omDriver)
$driver = new $driverClassName();
$driver->setOriginalDriver($omDriver);
if ($driver instanceof FileDriver) {
- $driver->setPaths($omDriver->getLocator()->getPaths());
- $driver->setExtension($omDriver->getLocator()->getFileExtension());
+ if ($omDriver instanceof MappingDriver) {
+ $driver->setPaths($omDriver->getLocator()->getPaths());
+ $driver->setExtension($omDriver->getLocator()->getFileExtension());
+ } else {
+ // BC for Doctrine 2.2
+ $driver->setPaths($omDriver->getPaths());
+ $driver->setExtension($omDriver->getFileExtension());
+ }
}
if ($driver instanceof AnnotationDriverInterface) {
$driver->setAnnotationReader($this->annotationReader);

0 comments on commit 01ca830

Please sign in to comment.