@Target annotation and support to common 2.2-DEV
This commit is contained in:
parent
e13720c33d
commit
a04d2933fa
@ -23,19 +23,31 @@ use Doctrine\Common\Annotations\Annotation;
|
|||||||
|
|
||||||
/* Annotations */
|
/* Annotations */
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("CLASS")
|
||||||
|
*/
|
||||||
final class Entity extends Annotation {
|
final class Entity extends Annotation {
|
||||||
public $repositoryClass;
|
public $repositoryClass;
|
||||||
public $readOnly = false;
|
public $readOnly = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("CLASS")
|
||||||
|
*/
|
||||||
final class MappedSuperclass extends Annotation {}
|
final class MappedSuperclass extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("CLASS")
|
||||||
|
*/
|
||||||
final class InheritanceType extends Annotation {}
|
final class InheritanceType extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("CLASS")
|
||||||
|
*/
|
||||||
final class DiscriminatorColumn extends Annotation {
|
final class DiscriminatorColumn extends Annotation {
|
||||||
public $name;
|
public $name;
|
||||||
public $fieldName; // field name used in non-object hydration (array/scalar)
|
public $fieldName; // field name used in non-object hydration (array/scalar)
|
||||||
@ -43,21 +55,36 @@ final class DiscriminatorColumn extends Annotation {
|
|||||||
public $length;
|
public $length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("CLASS")
|
||||||
|
*/
|
||||||
final class DiscriminatorMap extends Annotation {}
|
final class DiscriminatorMap extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("PROPERTY")
|
||||||
|
*/
|
||||||
final class Id extends Annotation {}
|
final class Id extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("PROPERTY")
|
||||||
|
*/
|
||||||
final class GeneratedValue extends Annotation {
|
final class GeneratedValue extends Annotation {
|
||||||
public $strategy = 'AUTO';
|
public $strategy = 'AUTO';
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("PROPERTY")
|
||||||
|
*/
|
||||||
final class Version extends Annotation {}
|
final class Version extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target({"PROPERTY","ANNOTATION"})
|
||||||
|
*/
|
||||||
final class JoinColumn extends Annotation {
|
final class JoinColumn extends Annotation {
|
||||||
public $name;
|
public $name;
|
||||||
public $fieldName; // field name used in non-object hydration (array/scalar)
|
public $fieldName; // field name used in non-object hydration (array/scalar)
|
||||||
@ -68,10 +95,16 @@ final class JoinColumn extends Annotation {
|
|||||||
public $columnDefinition;
|
public $columnDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("PROPERTY")
|
||||||
|
*/
|
||||||
final class JoinColumns extends Annotation {}
|
final class JoinColumns extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("PROPERTY")
|
||||||
|
*/
|
||||||
final class Column extends Annotation {
|
final class Column extends Annotation {
|
||||||
public $type = 'string';
|
public $type = 'string';
|
||||||
public $length;
|
public $length;
|
||||||
@ -86,7 +119,10 @@ final class Column extends Annotation {
|
|||||||
public $columnDefinition;
|
public $columnDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("PROPERTY")
|
||||||
|
*/
|
||||||
final class OneToOne extends Annotation {
|
final class OneToOne extends Annotation {
|
||||||
public $targetEntity;
|
public $targetEntity;
|
||||||
public $mappedBy;
|
public $mappedBy;
|
||||||
@ -96,7 +132,10 @@ final class OneToOne extends Annotation {
|
|||||||
public $orphanRemoval = false;
|
public $orphanRemoval = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("PROPERTY")
|
||||||
|
*/
|
||||||
final class OneToMany extends Annotation {
|
final class OneToMany extends Annotation {
|
||||||
public $mappedBy;
|
public $mappedBy;
|
||||||
public $targetEntity;
|
public $targetEntity;
|
||||||
@ -106,7 +145,10 @@ final class OneToMany extends Annotation {
|
|||||||
public $indexBy;
|
public $indexBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("PROPERTY")
|
||||||
|
*/
|
||||||
final class ManyToOne extends Annotation {
|
final class ManyToOne extends Annotation {
|
||||||
public $targetEntity;
|
public $targetEntity;
|
||||||
public $cascade;
|
public $cascade;
|
||||||
@ -114,7 +156,10 @@ final class ManyToOne extends Annotation {
|
|||||||
public $inversedBy;
|
public $inversedBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("PROPERTY")
|
||||||
|
*/
|
||||||
final class ManyToMany extends Annotation {
|
final class ManyToMany extends Annotation {
|
||||||
public $targetEntity;
|
public $targetEntity;
|
||||||
public $mappedBy;
|
public $mappedBy;
|
||||||
@ -124,12 +169,19 @@ final class ManyToMany extends Annotation {
|
|||||||
public $indexBy;
|
public $indexBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("ALL")
|
||||||
|
* @todo check available targets
|
||||||
|
*/
|
||||||
final class ElementCollection extends Annotation {
|
final class ElementCollection extends Annotation {
|
||||||
public $tableName;
|
public $tableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("CLASS")
|
||||||
|
*/
|
||||||
final class Table extends Annotation {
|
final class Table extends Annotation {
|
||||||
public $name;
|
public $name;
|
||||||
public $schema;
|
public $schema;
|
||||||
@ -137,19 +189,28 @@ final class Table extends Annotation {
|
|||||||
public $uniqueConstraints;
|
public $uniqueConstraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("ANNOTATION")
|
||||||
|
*/
|
||||||
final class UniqueConstraint extends Annotation {
|
final class UniqueConstraint extends Annotation {
|
||||||
public $name;
|
public $name;
|
||||||
public $columns;
|
public $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("ANNOTATION")
|
||||||
|
*/
|
||||||
final class Index extends Annotation {
|
final class Index extends Annotation {
|
||||||
public $name;
|
public $name;
|
||||||
public $columns;
|
public $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("PROPERTY")
|
||||||
|
*/
|
||||||
final class JoinTable extends Annotation {
|
final class JoinTable extends Annotation {
|
||||||
public $name;
|
public $name;
|
||||||
public $schema;
|
public $schema;
|
||||||
@ -157,49 +218,89 @@ final class JoinTable extends Annotation {
|
|||||||
public $inverseJoinColumns = array();
|
public $inverseJoinColumns = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("PROPERTY")
|
||||||
|
*/
|
||||||
final class SequenceGenerator extends Annotation {
|
final class SequenceGenerator extends Annotation {
|
||||||
public $sequenceName;
|
public $sequenceName;
|
||||||
public $allocationSize = 1;
|
public $allocationSize = 1;
|
||||||
public $initialValue = 1;
|
public $initialValue = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("CLASS")
|
||||||
|
*/
|
||||||
final class ChangeTrackingPolicy extends Annotation {}
|
final class ChangeTrackingPolicy extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("PROPERTY")
|
||||||
|
*/
|
||||||
final class OrderBy extends Annotation {}
|
final class OrderBy extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("CLASS")
|
||||||
|
*/
|
||||||
final class NamedQueries extends Annotation {}
|
final class NamedQueries extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("ANNOTATION")
|
||||||
|
*/
|
||||||
final class NamedQuery extends Annotation {
|
final class NamedQuery extends Annotation {
|
||||||
public $name;
|
public $name;
|
||||||
public $query;
|
public $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Annotations for lifecycle callbacks */
|
/* Annotations for lifecycle callbacks */
|
||||||
/** @Annotation */
|
|
||||||
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("CLASS")
|
||||||
|
*/
|
||||||
final class HasLifecycleCallbacks extends Annotation {}
|
final class HasLifecycleCallbacks extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("METHOD")
|
||||||
|
*/
|
||||||
final class PrePersist extends Annotation {}
|
final class PrePersist extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("METHOD")
|
||||||
|
*/
|
||||||
final class PostPersist extends Annotation {}
|
final class PostPersist extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("METHOD")
|
||||||
|
*/
|
||||||
final class PreUpdate extends Annotation {}
|
final class PreUpdate extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("METHOD")
|
||||||
|
*/
|
||||||
final class PostUpdate extends Annotation {}
|
final class PostUpdate extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("METHOD")
|
||||||
|
*/
|
||||||
final class PreRemove extends Annotation {}
|
final class PreRemove extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("METHOD")
|
||||||
|
*/
|
||||||
final class PostRemove extends Annotation {}
|
final class PostRemove extends Annotation {}
|
||||||
|
|
||||||
/** @Annotation */
|
/**
|
||||||
|
* @Annotation
|
||||||
|
* @Target("METHOD")
|
||||||
|
*/
|
||||||
final class PostLoad extends Annotation {}
|
final class PostLoad extends Annotation {}
|
||||||
|
@ -302,7 +302,7 @@ public function <methodName>()
|
|||||||
*/
|
*/
|
||||||
public function setAnnotationPrefix($prefix)
|
public function setAnnotationPrefix($prefix)
|
||||||
{
|
{
|
||||||
if (version_compare(\Doctrine\Common\Version::VERSION, '3.0.0-DEV', '>=')) {
|
if (version_compare(\Doctrine\Common\Version::VERSION, '2.2.0-DEV', '>=')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->_annotationsPrefix = $prefix;
|
$this->_annotationsPrefix = $prefix;
|
||||||
|
@ -24,7 +24,14 @@ abstract class OrmTestCase extends DoctrineTestCase
|
|||||||
$reader = new \Doctrine\Common\Annotations\CachedReader(
|
$reader = new \Doctrine\Common\Annotations\CachedReader(
|
||||||
new \Doctrine\Common\Annotations\AnnotationReader(), new ArrayCache()
|
new \Doctrine\Common\Annotations\AnnotationReader(), new ArrayCache()
|
||||||
);
|
);
|
||||||
} else if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0-BETA3-DEV', '>=')) {
|
}
|
||||||
|
else if (version_compare(\Doctrine\Common\Version::VERSION, '2.2.0-DEV', '>=')) {
|
||||||
|
// Register the ORM Annotations in the AnnotationRegistry
|
||||||
|
$reader = new \Doctrine\Common\Annotations\SimpleAnnotationReader();
|
||||||
|
$reader->addNamespace('Doctrine\ORM\Mapping');
|
||||||
|
$reader = new \Doctrine\Common\Annotations\CachedReader($reader, new ArrayCache());
|
||||||
|
}
|
||||||
|
else if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0-BETA3-DEV', '>=')) {
|
||||||
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
|
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
|
||||||
$reader->setIgnoreNotImportedAnnotations(true);
|
$reader->setIgnoreNotImportedAnnotations(true);
|
||||||
$reader->setEnableParsePhpImports(false);
|
$reader->setEnableParsePhpImports(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user