Ver código fonte

[DoctrineBundle] changes the naming convention for YML, and XML metadata files

Johannes Schmitt 14 anos atrás
pai
commit
ff4a2209e3

+ 5 - 4
UPDATE.md

@@ -13,8 +13,9 @@ beta1 to beta2
   is now managed directly by Symfony SE in ``AppKernel``.
 
 * The Doctrine metadata files has moved from
-  ``Resources/config/doctrine/metadata/orm/`` to ``Resources/config/doctrine``
-  and the extension from ``.dcm.yml`` to ``.orm.yml``
+  ``Resources/config/doctrine/metadata/orm/`` to ``Resources/config/doctrine``,
+  the extension from ``.dcm.yml`` to ``.orm.yml``, and the file name has been
+  changed to the short class name.
 
   Before:
 
@@ -23,8 +24,8 @@ beta1 to beta2
 
   After:
 
-        Resources/config/doctrine/Bundle.Entity.orm.xml
-        Resources/config/doctrine/Bundle.Entity.orm.yml
+        Resources/config/doctrine/Entity.orm.xml
+        Resources/config/doctrine/Entity.orm.yml
 
 * With the introduction of a new Doctrine Registry class, the following
   parameters have been removed (replaced by methods on the `doctrine`

+ 9 - 0
src/Symfony/Bundle/DoctrineBundle/Mapping/Driver/XmlDriver.php

@@ -60,4 +60,13 @@ class XmlDriver extends BaseXmlDriver
             }
         }
     }
+
+    protected function _findMappingFile($className)
+    {
+        if (false !== $pos = strrpos($className, '\\')) {
+            $className = substr($className, $pos+1);
+        }
+
+        return parent::_findMappingFile($className);
+    }
 }

+ 9 - 0
src/Symfony/Bundle/DoctrineBundle/Mapping/Driver/YamlDriver.php

@@ -60,4 +60,13 @@ class YamlDriver extends BaseYamlDriver
             }
         }
     }
+
+    protected function _findMappingFile($className)
+    {
+        if (false !== $pos = strrpos($className, '\\')) {
+            $className = substr($className, $pos+1);
+        }
+
+        return parent::_findMappingFile($className);
+    }
 }