1
0
mirror of synced 2024-12-13 22:56:04 +03:00

added support for @Enum

This commit is contained in:
Fabio B. Silva 2012-11-12 14:18:11 -02:00
parent 0d58e6627a
commit a07c63dde6
9 changed files with 118 additions and 33 deletions

View File

@ -25,6 +25,10 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class ChangeTrackingPolicy implements Annotation final class ChangeTrackingPolicy implements Annotation
{ {
/** @var string */ /**
* @var string The change tracking policy.
*
* @Enum({"DEFERRED_IMPLICIT", "DEFERRED_EXPLICIT", "NOTIFY"})
*/
public $value; public $value;
} }

View File

@ -25,6 +25,10 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class GeneratedValue implements Annotation final class GeneratedValue implements Annotation
{ {
/** @var string */ /**
* @var string The type of Id generator.
*
* @Enum({"AUTO", "SEQUENCE", "TABLE", "IDENTITY", "NONE", "UUID", "CUSTOM"})
*/
public $strategy = 'AUTO'; public $strategy = 'AUTO';
} }

View File

@ -25,6 +25,10 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class InheritanceType implements Annotation final class InheritanceType implements Annotation
{ {
/** @var string */ /**
* @var string The inheritance type used by the class and it's subclasses.
*
* @Enum({"NONE", "JOINED", "SINGLE_TABLE", "TABLE_PER_CLASS"})
*/
public $value; public $value;
} }

View File

@ -25,18 +25,40 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class ManyToMany implements Annotation final class ManyToMany implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $targetEntity; public $targetEntity;
/** @var string */
/**
* @var string
*/
public $mappedBy; public $mappedBy;
/** @var string */
/**
* @var string
*/
public $inversedBy; public $inversedBy;
/** @var array<string> */
/**
* @var array<string>
*/
public $cascade; public $cascade;
/** @var string */
/**
* @var string The fetching strategy to use for the association.
*
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
*/
public $fetch = 'LAZY'; public $fetch = 'LAZY';
/** @var boolean */
/**
* @var boolean
*/
public $orphanRemoval = false; public $orphanRemoval = false;
/** @var string */
/**
* @var string
*/
public $indexBy; public $indexBy;
} }

View File

@ -25,12 +25,25 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class ManyToOne implements Annotation final class ManyToOne implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $targetEntity; public $targetEntity;
/** @var array<string> */
/**
* @var array<string>
*/
public $cascade; public $cascade;
/** @var string */
/**
* @var string The fetching strategy to use for the association.
*
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
*/
public $fetch = 'LAZY'; public $fetch = 'LAZY';
/** @var string */
/**
* @var string
*/
public $inversedBy; public $inversedBy;
} }

View File

@ -25,16 +25,35 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class OneToMany implements Annotation final class OneToMany implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $mappedBy; public $mappedBy;
/** @var string */
/**
* @var string
*/
public $targetEntity; public $targetEntity;
/** @var array<string> */
/**
* @var array<string>
*/
public $cascade; public $cascade;
/** @var string */
/**
* @var string The fetching strategy to use for the association.
*
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
*/
public $fetch = 'LAZY'; public $fetch = 'LAZY';
/** @var boolean */
/**
* @var boolean
*/
public $orphanRemoval = false; public $orphanRemoval = false;
/** @var string */
/**
* @var string
*/
public $indexBy; public $indexBy;
} }

View File

@ -25,16 +25,35 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class OneToOne implements Annotation final class OneToOne implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $targetEntity; public $targetEntity;
/** @var string */
/**
* @var string
*/
public $mappedBy; public $mappedBy;
/** @var string */
/**
* @var string
*/
public $inversedBy; public $inversedBy;
/** @var array<string> */
/**
* @var array<string>
*/
public $cascade; public $cascade;
/** @var string */
/**
* @var string The fetching strategy to use for the association.
*
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
*/
public $fetch = 'LAZY'; public $fetch = 'LAZY';
/** @var boolean */
/**
* @var boolean
*/
public $orphanRemoval = false; public $orphanRemoval = false;
} }

@ -1 +1 @@
Subproject commit 0f7ba7fa7179bf445779f63fe5ccad355c81c06b Subproject commit cab6ec62f72c9af5d444c2b4fffe3ebcacac2479

View File

@ -211,8 +211,8 @@ class AnnotationDriverTest extends AbstractMappingDriverTest
$factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(); $factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory();
$factory->setEntityManager($em); $factory->setEntityManager($em);
$this->setExpectedException('Doctrine\ORM\Mapping\MappingException', $this->setExpectedException('Doctrine\Common\Annotations\AnnotationException',
"Entity 'Doctrine\Tests\ORM\Mapping\InvalidFetchOption' has a mapping with invalid fetch mode 'eager"); '[Enum Error] Attribute "fetch" of @Doctrine\ORM\Mapping\OneToMany declared on property Doctrine\Tests\ORM\Mapping\InvalidFetchOption::$collection accept only [LAZY, EAGER, EXTRA_LAZY], but got eager.');
$cm = $factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\InvalidFetchOption'); $cm = $factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\InvalidFetchOption');
} }