Browse Source

[mapping] tested and adapted with 2.1.x 2.2.x and starting 2.3.x versions

gedi 13 years ago
parent
commit
d74f8735d0

+ 2 - 2
lib/Gedmo/Tree/Strategy/ORM/Closure.php

@@ -86,7 +86,7 @@ class Closure implements Strategy
                 'fetch' => ClassMetadataInfo::FETCH_LAZY
                 'fetch' => ClassMetadataInfo::FETCH_LAZY
             );
             );
             $closureMetadata->mapManyToOne($ancestorMapping);
             $closureMetadata->mapManyToOne($ancestorMapping);
-            if (Version::compare('2.3.0') >= 0) {
+            if (Version::compare('2.3.0-dev') <= 0) {
                 $closureMetadata->reflFields['ancestor'] = $cmf
                 $closureMetadata->reflFields['ancestor'] = $cmf
                     ->getReflectionService()
                     ->getReflectionService()
                     ->getAccessibleProperty($closureMetadata->name, 'ancestor')
                     ->getAccessibleProperty($closureMetadata->name, 'ancestor')
@@ -116,7 +116,7 @@ class Closure implements Strategy
                 'fetch' => ClassMetadataInfo::FETCH_LAZY
                 'fetch' => ClassMetadataInfo::FETCH_LAZY
             );
             );
             $closureMetadata->mapManyToOne($descendantMapping);
             $closureMetadata->mapManyToOne($descendantMapping);
-            if (Version::compare('2.3.0') >= 0) {
+            if (Version::compare('2.3.0-dev') <= 0) {
                 $closureMetadata->reflFields['descendant'] = $cmf
                 $closureMetadata->reflFields['descendant'] = $cmf
                     ->getReflectionService()
                     ->getReflectionService()
                     ->getAccessibleProperty($closureMetadata->name, 'descendant')
                     ->getAccessibleProperty($closureMetadata->name, 'descendant')

+ 1 - 66
lib/Gedmo/Version.php

@@ -20,70 +20,5 @@ final class Version
     /**
     /**
      * Current version of extensions
      * Current version of extensions
      */
      */
-    const VERSION = '2.2.0-DEV';
-
-    /**
-     * Checks the dependent ORM library components
-     * for compatibility
-     *
-     * @throws DependentComponentNotFoundException
-     * @throws IncompatibleComponentVersionException
-     */
-    public static function checkORMDependencies()
-    {
-        // doctrine common library
-        if (!class_exists('Doctrine\\Common\\Version')) {
-            throw new DependentComponentNotFoundException("Doctrine\\Common library is either not registered by autoloader or not installed");
-        }
-        if (\Doctrine\Common\Version::compare(self::VERSION) > 0) {
-            throw new IncompatibleComponentVersionException("Doctrine\\Common library is older than expected for these extensions");
-        }
-
-        // doctrine dbal library
-        if (!class_exists('Doctrine\\DBAL\\Version')) {
-            throw new DependentComponentNotFoundException("Doctrine\\DBAL library is either not registered by autoloader or not installed");
-        }
-        if (\Doctrine\DBAL\Version::compare(self::VERSION) > 0) {
-            throw new IncompatibleComponentVersionException("Doctrine\\DBAL library is older than expected for these extensions");
-        }
-
-        // doctrine ORM library
-        if (!class_exists('Doctrine\\ORM\\Version')) {
-            throw new DependentComponentNotFoundException("Doctrine\\ORM library is either not registered by autoloader or not installed");
-        }
-        if (\Doctrine\ORM\Version::compare(self::VERSION) > 0) {
-            throw new IncompatibleComponentVersionException("Doctrine\\ORM library is older than expected for these extensions");
-        }
-    }
-
-    /**
-     * Checks the dependent ODM MongoDB library components
-     * for compatibility
-     *
-     * @throws DependentComponentNotFoundException
-     * @throws IncompatibleComponentVersionException
-     */
-    public static function checkODMMongoDBDependencies()
-    {
-        // doctrine common library
-        if (!class_exists('Doctrine\\Common\\Version')) {
-            throw new DependentComponentNotFoundException("Doctrine\\Common library is either not registered by autoloader or not installed");
-        }
-        if (\Doctrine\Common\Version::compare(self::VERSION) > 0) {
-            throw new IncompatibleComponentVersionException("Doctrine\\Common library is older than expected for these extensions");
-        }
-
-        // doctrine mongodb library
-        if (!class_exists('Doctrine\\MongoDB\\Database')) {
-            throw new DependentComponentNotFoundException("Doctrine\\MongoDB library is either not registered by autoloader or not installed");
-        }
-
-        // doctrine ODM MongoDB library
-        if (!class_exists('Doctrine\\ODM\\MongoDB\\Version')) {
-            throw new DependentComponentNotFoundException("Doctrine\\ODM\\MongoDB library is either not registered by autoloader or not installed");
-        }
-        if (\Doctrine\ODM\MongoDB\Version::compare('1.0.0BETA3-DEV') > 0) {
-            throw new IncompatibleComponentVersionException("Doctrine\\ODM\\MongoDB library is older than expected for these extensions");
-        }
-    }
+    const VERSION = '2.3.0-DEV';
 }
 }

+ 1 - 1
tests/Gedmo/Mapping/MetadataFactory/ForcedMetadataTest.php

@@ -65,7 +65,7 @@ class ForcedMetadataTest extends \PHPUnit_Framework_TestCase
         $eventArgs = new \Doctrine\ORM\Event\LoadClassMetadataEventArgs($metadata, $this->em);
         $eventArgs = new \Doctrine\ORM\Event\LoadClassMetadataEventArgs($metadata, $this->em);
         $evm->dispatchEvent(\Doctrine\ORM\Events::loadClassMetadata, $eventArgs);
         $evm->dispatchEvent(\Doctrine\ORM\Events::loadClassMetadata, $eventArgs);
 
 
-        if (Version::compare('2.3.0') >= 0) {
+        if (Version::compare('2.3.0-dev') <= 0) {
             $metadata->wakeupReflection($cmf->getReflectionService());
             $metadata->wakeupReflection($cmf->getReflectionService());
         }
         }
         $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->em);
         $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->em);

+ 0 - 3
tests/bootstrap.php

@@ -52,9 +52,6 @@ $loader->registerNamespaces(array(
 ));
 ));
 $loader->register();
 $loader->register();
 
 
-Gedmo\Version::checkODMMongoDBDependencies();
-Gedmo\Version::checkORMDependencies();
-
 \Doctrine\Common\Annotations\AnnotationRegistry::registerFile(
 \Doctrine\Common\Annotations\AnnotationRegistry::registerFile(
     VENDOR_PATH.'/doctrine-orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'
     VENDOR_PATH.'/doctrine-orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'
 );
 );