Browse Source

[mapping] updated annotations and documentation related

gediminasm 13 years ago
parent
commit
03a7fd5fc7

+ 5 - 0
README.md

@@ -7,6 +7,11 @@
 **Note:** Use 2.1.x tag in order to use extensions based on Doctrine2.1.x versions. Currently
 **Note:** Use 2.1.x tag in order to use extensions based on Doctrine2.1.x versions. Currently
 master branch is based on 2.2.x versions and may not work with 2.1.x components
 master branch is based on 2.2.x versions and may not work with 2.1.x components
 
 
+**2011-10-30**
+
+- Support for doctrine common **2.2.x** with backward compatibility. Be sure to use all components
+from the specific version, etc.: **2.2.x** or **2.1.x** both are supported
+
 **2011-10-23**
 **2011-10-23**
 
 
 - [@everzet](https://github.com/everzet) has contributed the **Translator** behavior, which indeed
 - [@everzet](https://github.com/everzet) has contributed the **Translator** behavior, which indeed

+ 17 - 3
doc/annotations.md

@@ -68,10 +68,24 @@ mapping and listeners:
 
 
     $reader = new \Doctrine\Common\Annotations\AnnotationReader();
     $reader = new \Doctrine\Common\Annotations\AnnotationReader();
     $annotationDriver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader);
     $annotationDriver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader);
+    Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace(
+        'Gedmo\\Mapping\\Annotation',
+        'path/to/gedmo/extension/library'
+    );
     
     
     $chain = new \Doctrine\ORM\Mapping\Driver\DriverChain;
     $chain = new \Doctrine\ORM\Mapping\Driver\DriverChain;
-    $chain->addDriver($annotationDriver, 'Gedmo\Translatable\Entity');
-    $chain->addDriver($annotationDriver, 'Gedmo\Tree\Entity');
+    $annotationDriver = new Doctrine\ORM\Mapping\Driver\AnnotationDriver($annotationReader, array(
+        __DIR__.'/../your/application/source/Entity',
+        'path/to/gedmo/extension/library'.'/Gedmo/Translatable/Entity',
+        'path/to/gedmo/extension/library'.'/Gedmo/Loggable/Entity',
+        'path/to/gedmo/extension/library'.'/Gedmo/Tree/Entity',
+    ));
+    // drivers
+    $driverChain->addDriver($annotationDriver, 'Gedmo\\Translatable\\Entity');
+    $driverChain->addDriver($annotationDriver, 'Gedmo\\Loggable\\Entity');
+    $driverChain->addDriver($annotationDriver, 'Gedmo\\Tree\\Entity');
+    $driverChain->addDriver($annotationDriver, 'Entity');
+    $config->setMetadataDriverImpl($driverChain);
     
     
     $config = new \Doctrine\ORM\Configuration();
     $config = new \Doctrine\ORM\Configuration();
     $config->setMetadataDriverImpl($chain);
     $config->setMetadataDriverImpl($chain);
@@ -99,7 +113,7 @@ mapping and listeners:
     );
     );
     $em = \Doctrine\ORM\EntityManager::create($conn, $config, $evm);
     $em = \Doctrine\ORM\EntityManager::create($conn, $config, $evm);
 
 
-**Notice:** that symfony2 DoctrineExtensionsBundle does it automatically this
+**Notice:** that symfony2 StofDoctrineExtensionsBundle does it automatically this
 way you will maintain a single instance of annotation reader. It relates only
 way you will maintain a single instance of annotation reader. It relates only
 to doctrine-common-2.1.x branch and newer.
 to doctrine-common-2.1.x branch and newer.
 
 

+ 1 - 0
lib/Gedmo/Mapping/Annotation/Language.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * Language annotation for Translatable behavioral extension
  * Language annotation for Translatable behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("PROPERTY")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation

+ 1 - 0
lib/Gedmo/Mapping/Annotation/Locale.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * Locale annotation for Translatable behavioral extension
  * Locale annotation for Translatable behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("PROPERTY")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation

+ 2 - 0
lib/Gedmo/Mapping/Annotation/Loggable.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * Loggable annotation for Loggable behavioral extension
  * Loggable annotation for Loggable behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("CLASS")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation
@@ -17,6 +18,7 @@ use Doctrine\Common\Annotations\Annotation;
  */
  */
 final class Loggable extends Annotation
 final class Loggable extends Annotation
 {
 {
+    /** @var string */
     public $logEntryClass;
     public $logEntryClass;
 }
 }
 
 

+ 7 - 0
lib/Gedmo/Mapping/Annotation/Slug.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * Slug annotation for Sluggable behavioral extension
  * Slug annotation for Sluggable behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("PROPERTY")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation
@@ -17,11 +18,17 @@ use Doctrine\Common\Annotations\Annotation;
  */
  */
 final class Slug extends Annotation
 final class Slug extends Annotation
 {
 {
+    /** @var array<string> @required */
     public $fields = array();
     public $fields = array();
+    /** @var boolean */
     public $updatable = true;
     public $updatable = true;
+    /** @var string */
     public $style = 'default'; // or "camel"
     public $style = 'default'; // or "camel"
+    /** @var boolean */
     public $unique = true;
     public $unique = true;
+    /** @var string */
     public $separator = '-';
     public $separator = '-';
+    /** @var array<Gedmo\Mapping\Annotation\SlugHandler> */
     public $handlers = array();
     public $handlers = array();
 }
 }
 
 

+ 4 - 1
lib/Gedmo/Mapping/Annotation/SlugHandler.php

@@ -20,6 +20,7 @@ use Doctrine\Common\Annotations\Annotation;
  * }, separator="-", updatable=false)
  * }, separator="-", updatable=false)
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("ANNOTATION")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation
@@ -29,7 +30,9 @@ use Doctrine\Common\Annotations\Annotation;
  */
  */
 final class SlugHandler extends Annotation
 final class SlugHandler extends Annotation
 {
 {
-    public $class = '';
+    /** @var string @required */
+    public $class;
+    /** @var array<Gedmo\Mapping\Annotation\SlugHandlerOption> */
     public $options = array();
     public $options = array();
 }
 }
 
 

+ 3 - 0
lib/Gedmo/Mapping/Annotation/SlugHandlerOption.php

@@ -20,6 +20,7 @@ use Doctrine\Common\Annotations\Annotation;
  * }, separator="-", updatable=false)
  * }, separator="-", updatable=false)
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("ANNOTATION")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation
@@ -29,7 +30,9 @@ use Doctrine\Common\Annotations\Annotation;
  */
  */
 final class SlugHandlerOption extends Annotation
 final class SlugHandlerOption extends Annotation
 {
 {
+    /** @var string */
     public $name;
     public $name;
+    /** @var mixed */
     public $value;
     public $value;
 }
 }
 
 

+ 2 - 1
lib/Gedmo/Mapping/Annotation/SortableGroup.php

@@ -12,8 +12,9 @@ use Doctrine\Common\Annotations\Annotation;
  * @subpackage SortableGroup
  * @subpackage SortableGroup
  * @link http://www.gediminasm.org
  * @link http://www.gediminasm.org
  * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
- * 
+ *
  * @Annotation
  * @Annotation
+ * @Target("PROPERTY")
  */
  */
 final class SortableGroup extends Annotation
 final class SortableGroup extends Annotation
 {
 {

+ 2 - 1
lib/Gedmo/Mapping/Annotation/SortablePosition.php

@@ -12,8 +12,9 @@ use Doctrine\Common\Annotations\Annotation;
  * @subpackage SortableGroup
  * @subpackage SortableGroup
  * @link http://www.gediminasm.org
  * @link http://www.gediminasm.org
  * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
- * 
+ *
  * @Annotation
  * @Annotation
+ * @Target("PROPERTY")
  */
  */
 final class SortablePosition extends Annotation
 final class SortablePosition extends Annotation
 {
 {

+ 4 - 0
lib/Gedmo/Mapping/Annotation/Timestampable.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * Timestampable annotation for Timestampable behavioral extension
  * Timestampable annotation for Timestampable behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("PROPERTY")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation
@@ -17,8 +18,11 @@ use Doctrine\Common\Annotations\Annotation;
  */
  */
 final class Timestampable extends Annotation
 final class Timestampable extends Annotation
 {
 {
+    /** @var string */
     public $on = 'update';
     public $on = 'update';
+    /** @var string */
     public $field;
     public $field;
+    /** @var mixed */
     public $value;
     public $value;
 }
 }
 
 

+ 1 - 0
lib/Gedmo/Mapping/Annotation/Translatable.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * Translatable annotation for Translatable behavioral extension
  * Translatable annotation for Translatable behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("PROPERTY")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation

+ 2 - 0
lib/Gedmo/Mapping/Annotation/TranslationEntity.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * TranslationEntity annotation for Translatable behavioral extension
  * TranslationEntity annotation for Translatable behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("CLASS")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation
@@ -17,6 +18,7 @@ use Doctrine\Common\Annotations\Annotation;
  */
  */
 final class TranslationEntity extends Annotation
 final class TranslationEntity extends Annotation
 {
 {
+    /** @var string @required */
     public $class;
     public $class;
 }
 }
 
 

+ 2 - 0
lib/Gedmo/Mapping/Annotation/Tree.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * Tree annotation for Tree behavioral extension
  * Tree annotation for Tree behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("CLASS")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation
@@ -17,6 +18,7 @@ use Doctrine\Common\Annotations\Annotation;
  */
  */
 final class Tree extends Annotation
 final class Tree extends Annotation
 {
 {
+    /** @var string */
     public $type = 'nested';
     public $type = 'nested';
 }
 }
 
 

+ 2 - 0
lib/Gedmo/Mapping/Annotation/TreeClosure.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * TreeClosure annotation for Tree behavioral extension
  * TreeClosure annotation for Tree behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("CLASS")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation
@@ -17,6 +18,7 @@ use Doctrine\Common\Annotations\Annotation;
  */
  */
 final class TreeClosure extends Annotation
 final class TreeClosure extends Annotation
 {
 {
+    /** @var string @required */
     public $class;
     public $class;
 }
 }
 
 

+ 1 - 0
lib/Gedmo/Mapping/Annotation/TreeLeft.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * TreeLeft annotation for Tree behavioral extension
  * TreeLeft annotation for Tree behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("PROPERTY")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation

+ 1 - 0
lib/Gedmo/Mapping/Annotation/TreeLevel.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * TreeLevel annotation for Tree behavioral extension
  * TreeLevel annotation for Tree behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("PROPERTY")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation

+ 1 - 0
lib/Gedmo/Mapping/Annotation/TreeParent.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * TreeParent annotation for Tree behavioral extension
  * TreeParent annotation for Tree behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("PROPERTY")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation

+ 1 - 0
lib/Gedmo/Mapping/Annotation/TreeRight.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * TreeRight annotation for Tree behavioral extension
  * TreeRight annotation for Tree behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("PROPERTY")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation

+ 1 - 0
lib/Gedmo/Mapping/Annotation/TreeRoot.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * TreeRoot annotation for Tree behavioral extension
  * TreeRoot annotation for Tree behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("PROPERTY")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation

+ 1 - 0
lib/Gedmo/Mapping/Annotation/Versioned.php

@@ -8,6 +8,7 @@ use Doctrine\Common\Annotations\Annotation;
  * Versioned annotation for Loggable behavioral extension
  * Versioned annotation for Loggable behavioral extension
  *
  *
  * @Annotation
  * @Annotation
+ * @Target("PROPERTY")
  *
  *
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  * @package Gedmo.Mapping.Annotation
  * @package Gedmo.Mapping.Annotation

+ 1 - 1
lib/Gedmo/Version.php

@@ -20,7 +20,7 @@ final class Version
     /**
     /**
      * Current version of extensions
      * Current version of extensions
      */
      */
-    const VERSION = '2.1.0-DEV';
+    const VERSION = '2.2.0-DEV';
 
 
     /**
     /**
      * Checks the dependent ORM library components
      * Checks the dependent ORM library components