1
0
Fork 0
mirror of synced 2025-04-03 13:23:37 +03:00

Fixed documentation for ORM\Mapping

This commit is contained in:
Benjamin Morel 2012-12-03 09:36:08 +00:00
parent 4714a53c32
commit 46e6ada4f9
52 changed files with 1126 additions and 374 deletions

View file

@ -30,9 +30,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class AssociationOverride implements Annotation final class AssociationOverride implements Annotation
{ {
/** /**
* The name of the relationship property whose mapping is being overridden * The name of the relationship property whose mapping is being overridden.
* *
* @var string * @var string
*/ */
@ -45,12 +44,10 @@ final class AssociationOverride implements Annotation
*/ */
public $joinColumns; public $joinColumns;
/** /**
* The join table that maps the relationship. * The join table that maps the relationship.
* *
* @var \Doctrine\ORM\Mapping\JoinTable * @var \Doctrine\ORM\Mapping\JoinTable
*/ */
public $joinTable; public $joinTable;
} }

View file

@ -30,12 +30,10 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class AssociationOverrides implements Annotation final class AssociationOverrides implements Annotation
{ {
/** /**
* Mapping overrides of relationship properties * Mapping overrides of relationship properties.
* *
* @var array<\Doctrine\ORM\Mapping\AssociationOverride> * @var array<\Doctrine\ORM\Mapping\AssociationOverride>
*/ */
public $value; public $value;
} }

View file

@ -30,7 +30,6 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class AttributeOverride implements Annotation final class AttributeOverride implements Annotation
{ {
/** /**
* The name of the property whose mapping is being overridden. * The name of the property whose mapping is being overridden.
* *

View file

@ -30,12 +30,10 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class AttributeOverrides implements Annotation final class AttributeOverrides implements Annotation
{ {
/** /**
* One or more field or property mapping overrides. * One or more field or property mapping overrides.
* *
* @var array<\Doctrine\ORM\Mapping\AttributeOverride> * @var array<\Doctrine\ORM\Mapping\AttributeOverride>
*/ */
public $value; public $value;
} }

View file

@ -34,19 +34,19 @@ class AssociationBuilder
protected $mapping; protected $mapping;
/** /**
* @var array * @var array|null
*/ */
protected $joinColumns; protected $joinColumns;
/** /**
*
* @var int * @var int
*/ */
protected $type; protected $type;
/** /**
* @param ClassMetadataBuilder $builder * @param ClassMetadataBuilder $builder
* @param array $mapping * @param array $mapping
* @param int $type
*/ */
public function __construct(ClassMetadataBuilder $builder, array $mapping, $type) public function __construct(ClassMetadataBuilder $builder, array $mapping, $type)
{ {
@ -55,66 +55,103 @@ class AssociationBuilder
$this->type = $type; $this->type = $type;
} }
/**
* @param string $fieldName
*
* @return AssociationBuilder
*/
public function mappedBy($fieldName) public function mappedBy($fieldName)
{ {
$this->mapping['mappedBy'] = $fieldName; $this->mapping['mappedBy'] = $fieldName;
return $this; return $this;
} }
/**
* @param string $fieldName
*
* @return AssociationBuilder
*/
public function inversedBy($fieldName) public function inversedBy($fieldName)
{ {
$this->mapping['inversedBy'] = $fieldName; $this->mapping['inversedBy'] = $fieldName;
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function cascadeAll() public function cascadeAll()
{ {
$this->mapping['cascade'] = array("ALL"); $this->mapping['cascade'] = array("ALL");
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function cascadePersist() public function cascadePersist()
{ {
$this->mapping['cascade'][] = "persist"; $this->mapping['cascade'][] = "persist";
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function cascadeRemove() public function cascadeRemove()
{ {
$this->mapping['cascade'][] = "remove"; $this->mapping['cascade'][] = "remove";
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function cascadeMerge() public function cascadeMerge()
{ {
$this->mapping['cascade'][] = "merge"; $this->mapping['cascade'][] = "merge";
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function cascadeDetach() public function cascadeDetach()
{ {
$this->mapping['cascade'][] = "detach"; $this->mapping['cascade'][] = "detach";
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function cascadeRefresh() public function cascadeRefresh()
{ {
$this->mapping['cascade'][] = "refresh"; $this->mapping['cascade'][] = "refresh";
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function fetchExtraLazy() public function fetchExtraLazy()
{ {
$this->mapping['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY; $this->mapping['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function fetchEager() public function fetchEager()
{ {
$this->mapping['fetch'] = ClassMetadata::FETCH_EAGER; $this->mapping['fetch'] = ClassMetadata::FETCH_EAGER;
return $this; return $this;
} }
/**
* @return AssociationBuilder
*/
public function fetchLazy() public function fetchLazy()
{ {
$this->mapping['fetch'] = ClassMetadata::FETCH_LAZY; $this->mapping['fetch'] = ClassMetadata::FETCH_LAZY;
@ -122,14 +159,16 @@ class AssociationBuilder
} }
/** /**
* Add Join Columns * Add Join Columns.
* *
* @param string $columnName * @param string $columnName
* @param string $referencedColumnName * @param string $referencedColumnName
* @param bool $nullable * @param bool $nullable
* @param bool $unique * @param bool $unique
* @param string $onDelete * @param string|null $onDelete
* @param string $columnDef * @param string|null $columnDef
*
* @return AssociationBuilder
*/ */
public function addJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null) public function addJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null)
{ {
@ -146,6 +185,8 @@ class AssociationBuilder
/** /**
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*
* @throws \InvalidArgumentException
*/ */
public function build() public function build()
{ {

View file

@ -55,7 +55,7 @@ class ClassMetadataBuilder
} }
/** /**
* Mark the class as mapped superclass. * Marks the class as mapped superclass.
* *
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
@ -67,9 +67,10 @@ class ClassMetadataBuilder
} }
/** /**
* Set custom Repository class name * Sets custom Repository class name.
* *
* @param string $repositoryClassName * @param string $repositoryClassName
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function setCustomRepositoryClass($repositoryClassName) public function setCustomRepositoryClass($repositoryClassName)
@ -80,7 +81,7 @@ class ClassMetadataBuilder
} }
/** /**
* Mark class read only * Marks class read only.
* *
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
@ -92,9 +93,10 @@ class ClassMetadataBuilder
} }
/** /**
* Set the table name * Sets the table name.
* *
* @param string $name * @param string $name
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function setTable($name) public function setTable($name)
@ -105,10 +107,11 @@ class ClassMetadataBuilder
} }
/** /**
* Add Index * Adds Index.
* *
* @param array $columns * @param array $columns
* @param string $name * @param string $name
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addIndex(array $columns, $name) public function addIndex(array $columns, $name)
@ -123,10 +126,11 @@ class ClassMetadataBuilder
} }
/** /**
* Add Unique Constraint * Adds Unique Constraint.
* *
* @param array $columns * @param array $columns
* @param string $name * @param string $name
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addUniqueConstraint(array $columns, $name) public function addUniqueConstraint(array $columns, $name)
@ -141,10 +145,11 @@ class ClassMetadataBuilder
} }
/** /**
* Add named query * Adds named query.
* *
* @param string $name * @param string $name
* @param string $dqlQuery * @param string $dqlQuery
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addNamedQuery($name, $dqlQuery) public function addNamedQuery($name, $dqlQuery)
@ -158,7 +163,7 @@ class ClassMetadataBuilder
} }
/** /**
* Set class as root of a joined table inheritance hierachy. * Sets class as root of a joined table inheritance hierachy.
* *
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
@ -170,7 +175,7 @@ class ClassMetadataBuilder
} }
/** /**
* Set class as root of a single table inheritance hierachy. * Sets class as root of a single table inheritance hierachy.
* *
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
@ -182,10 +187,13 @@ class ClassMetadataBuilder
} }
/** /**
* Set the discriminator column details. * Sets the discriminator column details.
* *
* @param string $name * @param string $name
* @param string $type * @param string $type
* @param int $length
*
* @return ClassMetadataBuilder
*/ */
public function setDiscriminatorColumn($name, $type = 'string', $length = 255) public function setDiscriminatorColumn($name, $type = 'string', $length = 255)
{ {
@ -199,10 +207,11 @@ class ClassMetadataBuilder
} }
/** /**
* Add a subclass to this inheritance hierachy. * Adds a subclass to this inheritance hierachy.
* *
* @param string $name * @param string $name
* @param string $class * @param string $class
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addDiscriminatorMapClass($name, $class) public function addDiscriminatorMapClass($name, $class)
@ -213,7 +222,7 @@ class ClassMetadataBuilder
} }
/** /**
* Set deferred explicit change tracking policy. * Sets deferred explicit change tracking policy.
* *
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
@ -225,7 +234,7 @@ class ClassMetadataBuilder
} }
/** /**
* Set notify change tracking policy. * Sets notify change tracking policy.
* *
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
@ -237,10 +246,11 @@ class ClassMetadataBuilder
} }
/** /**
* Add lifecycle event * Adds lifecycle event.
* *
* @param string $methodName * @param string $methodName
* @param string $event * @param string $event
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addLifecycleEvent($methodName, $event) public function addLifecycleEvent($methodName, $event)
@ -251,11 +261,13 @@ class ClassMetadataBuilder
} }
/** /**
* Add Field * Adds Field.
* *
* @param string $name * @param string $name
* @param string $type * @param string $type
* @param array $mapping * @param array $mapping
*
* @return ClassMetadataBuilder
*/ */
public function addField($name, $type, array $mapping = array()) public function addField($name, $type, array $mapping = array())
{ {
@ -268,10 +280,11 @@ class ClassMetadataBuilder
} }
/** /**
* Create a field builder. * Creates a field builder.
* *
* @param string $name * @param string $name
* @param string $type * @param string $type
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function createField($name, $type) public function createField($name, $type)
@ -286,11 +299,12 @@ class ClassMetadataBuilder
} }
/** /**
* Add a simple many to one association, optionally with the inversed by field. * Adds a simple many to one association, optionally with the inversed by field.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
* @param string|null $inversedBy * @param string|null $inversedBy
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addManyToOne($name, $targetEntity, $inversedBy = null) public function addManyToOne($name, $targetEntity, $inversedBy = null)
@ -305,12 +319,13 @@ class ClassMetadataBuilder
} }
/** /**
* Create a ManyToOne Assocation Builder. * Creates a ManyToOne Assocation Builder.
* *
* Note: This method does not add the association, you have to call build() on the AssociationBuilder. * Note: This method does not add the association, you have to call build() on the AssociationBuilder.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
*
* @return AssociationBuilder * @return AssociationBuilder
*/ */
public function createManyToOne($name, $targetEntity) public function createManyToOne($name, $targetEntity)
@ -326,10 +341,11 @@ class ClassMetadataBuilder
} }
/** /**
* Create OneToOne Assocation Builder * Creates a OneToOne Association Builder.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
*
* @return AssociationBuilder * @return AssociationBuilder
*/ */
public function createOneToOne($name, $targetEntity) public function createOneToOne($name, $targetEntity)
@ -345,11 +361,12 @@ class ClassMetadataBuilder
} }
/** /**
* Add simple inverse one-to-one assocation. * Adds simple inverse one-to-one assocation.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
* @param string $mappedBy * @param string $mappedBy
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addInverseOneToOne($name, $targetEntity, $mappedBy) public function addInverseOneToOne($name, $targetEntity, $mappedBy)
@ -361,11 +378,12 @@ class ClassMetadataBuilder
} }
/** /**
* Add simple owning one-to-one assocation. * Adds simple owning one-to-one assocation.
*
* @param string $name
* @param string $targetEntity
* @param string|null $inversedBy
* *
* @param string $name
* @param string $targetEntity
* @param string $inversedBy
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addOwningOneToOne($name, $targetEntity, $inversedBy = null) public function addOwningOneToOne($name, $targetEntity, $inversedBy = null)
@ -380,10 +398,11 @@ class ClassMetadataBuilder
} }
/** /**
* Create ManyToMany Assocation Builder * Creates a ManyToMany Assocation Builder.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
*
* @return ManyToManyAssociationBuilder * @return ManyToManyAssociationBuilder
*/ */
public function createManyToMany($name, $targetEntity) public function createManyToMany($name, $targetEntity)
@ -399,11 +418,12 @@ class ClassMetadataBuilder
} }
/** /**
* Add a simple owning many to many assocation. * Adds a simple owning many to many assocation.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
* @param string|null $inversedBy * @param string|null $inversedBy
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addOwningManyToMany($name, $targetEntity, $inversedBy = null) public function addOwningManyToMany($name, $targetEntity, $inversedBy = null)
@ -418,11 +438,12 @@ class ClassMetadataBuilder
} }
/** /**
* Add a simple inverse many to many assocation. * Adds a simple inverse many to many assocation.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
* @param string $mappedBy * @param string $mappedBy
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addInverseManyToMany($name, $targetEntity, $mappedBy) public function addInverseManyToMany($name, $targetEntity, $mappedBy)
@ -434,10 +455,11 @@ class ClassMetadataBuilder
} }
/** /**
* Create a one to many assocation builder * Creates a one to many assocation builder.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
*
* @return OneToManyAssociationBuilder * @return OneToManyAssociationBuilder
*/ */
public function createOneToMany($name, $targetEntity) public function createOneToMany($name, $targetEntity)
@ -453,11 +475,12 @@ class ClassMetadataBuilder
} }
/** /**
* Add simple OneToMany assocation. * Adds simple OneToMany assocation.
* *
* @param string $name * @param string $name
* @param string $targetEntity * @param string $targetEntity
* @param string $mappedBy * @param string $mappedBy
*
* @return ClassMetadataBuilder * @return ClassMetadataBuilder
*/ */
public function addOneToMany($name, $targetEntity, $mappedBy) public function addOneToMany($name, $targetEntity, $mappedBy)

View file

@ -33,10 +33,12 @@ class FieldBuilder
* @var ClassMetadataBuilder * @var ClassMetadataBuilder
*/ */
private $builder; private $builder;
/** /**
* @var array * @var array
*/ */
private $mapping; private $mapping;
/** /**
* @var bool * @var bool
*/ */
@ -53,9 +55,8 @@ class FieldBuilder
private $sequenceDef; private $sequenceDef;
/** /**
*
* @param ClassMetadataBuilder $builder * @param ClassMetadataBuilder $builder
* @param array $mapping * @param array $mapping
*/ */
public function __construct(ClassMetadataBuilder $builder, array $mapping) public function __construct(ClassMetadataBuilder $builder, array $mapping)
{ {
@ -64,9 +65,10 @@ class FieldBuilder
} }
/** /**
* Set length. * Sets length.
* *
* @param int $length * @param int $length
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function length($length) public function length($length)
@ -76,9 +78,10 @@ class FieldBuilder
} }
/** /**
* Set nullable * Sets nullable.
*
* @param bool $flag
* *
* @param bool
* @return FieldBuilder * @return FieldBuilder
*/ */
public function nullable($flag = true) public function nullable($flag = true)
@ -88,9 +91,10 @@ class FieldBuilder
} }
/** /**
* Set Unique * Sets Unique.
*
* @param bool $flag
* *
* @param bool
* @return FieldBuilder * @return FieldBuilder
*/ */
public function unique($flag = true) public function unique($flag = true)
@ -100,9 +104,10 @@ class FieldBuilder
} }
/** /**
* Set column name * Sets column name.
* *
* @param string $name * @param string $name
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function columnName($name) public function columnName($name)
@ -112,9 +117,10 @@ class FieldBuilder
} }
/** /**
* Set Precision * Sets Precision.
*
* @param int $p
* *
* @param int $p
* @return FieldBuilder * @return FieldBuilder
*/ */
public function precision($p) public function precision($p)
@ -124,9 +130,10 @@ class FieldBuilder
} }
/** /**
* Set scale. * Sets scale.
* *
* @param int $s * @param int $s
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function scale($s) public function scale($s)
@ -136,7 +143,7 @@ class FieldBuilder
} }
/** /**
* Set field as primary key. * Sets field as primary key.
* *
* @return FieldBuilder * @return FieldBuilder
*/ */
@ -147,7 +154,8 @@ class FieldBuilder
} }
/** /**
* @param int $strategy * @param string $strategy
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function generatedValue($strategy = 'AUTO') public function generatedValue($strategy = 'AUTO')
@ -157,7 +165,7 @@ class FieldBuilder
} }
/** /**
* Set field versioned * Sets field versioned.
* *
* @return FieldBuilder * @return FieldBuilder
*/ */
@ -168,11 +176,12 @@ class FieldBuilder
} }
/** /**
* Set Sequence Generator * Sets Sequence Generator.
* *
* @param string $sequenceName * @param string $sequenceName
* @param int $allocationSize * @param int $allocationSize
* @param int $initialValue * @param int $initialValue
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function setSequenceGenerator($sequenceName, $allocationSize = 1, $initialValue = 1) public function setSequenceGenerator($sequenceName, $allocationSize = 1, $initialValue = 1)
@ -186,9 +195,10 @@ class FieldBuilder
} }
/** /**
* Set column definition. * Sets column definition.
* *
* @param string $def * @param string $def
*
* @return FieldBuilder * @return FieldBuilder
*/ */
public function columnDefinition($def) public function columnDefinition($def)
@ -198,7 +208,7 @@ class FieldBuilder
} }
/** /**
* Finalize this field and attach it to the ClassMetadata. * Finalizes this field and attach it to the ClassMetadata.
* *
* Without this call a FieldBuilder has no effect on the ClassMetadata. * Without this call a FieldBuilder has no effect on the ClassMetadata.
* *

View file

@ -29,10 +29,21 @@ namespace Doctrine\ORM\Mapping\Builder;
*/ */
class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
{ {
/**
* @var string|null
*/
private $joinTableName; private $joinTableName;
/**
* @var array
*/
private $inverseJoinColumns = array(); private $inverseJoinColumns = array();
/**
* @param string $name
*
* @return ManyToManyAssociationBuilder
*/
public function setJoinTable($name) public function setJoinTable($name)
{ {
$this->joinTableName = $name; $this->joinTableName = $name;
@ -40,14 +51,16 @@ class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
} }
/** /**
* Add Inverse Join Columns * Adds Inverse Join Columns.
* *
* @param string $columnName * @param string $columnName
* @param string $referencedColumnName * @param string $referencedColumnName
* @param bool $nullable * @param bool $nullable
* @param bool $unique * @param bool $unique
* @param string $onDelete * @param string|null $onDelete
* @param string $columnDef * @param string|null $columnDef
*
* @return ManyToManyAssociationBuilder
*/ */
public function addInverseJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null) public function addInverseJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null)
{ {

View file

@ -31,6 +31,7 @@ class OneToManyAssociationBuilder extends AssociationBuilder
{ {
/** /**
* @param array $fieldNames * @param array $fieldNames
*
* @return OneToManyAssociationBuilder * @return OneToManyAssociationBuilder
*/ */
public function setOrderBy(array $fieldNames) public function setOrderBy(array $fieldNames)
@ -39,6 +40,11 @@ class OneToManyAssociationBuilder extends AssociationBuilder
return $this; return $this;
} }
/**
* @param string $fieldName
*
* @return OneToManyAssociationBuilder
*/
public function setIndexBy($fieldName) public function setIndexBy($fieldName)
{ {
$this->mapping['indexBy'] = $fieldName; $this->mapping['indexBy'] = $fieldName;

View file

@ -26,7 +26,9 @@ namespace Doctrine\ORM\Mapping;
final class ChangeTrackingPolicy implements Annotation final class ChangeTrackingPolicy implements Annotation
{ {
/** /**
* @var string The change tracking policy. * The change tracking policy.
*
* @var string
* *
* @Enum({"DEFERRED_IMPLICIT", "DEFERRED_EXPLICIT", "NOTIFY"}) * @Enum({"DEFERRED_IMPLICIT", "DEFERRED_EXPLICIT", "NOTIFY"})
*/ */

View file

@ -173,8 +173,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
/** /**
* Validate runtime metadata is correctly defined. * Validate runtime metadata is correctly defined.
* *
* @param ClassMetadata $class * @param ClassMetadata $class
* @param $parent * @param ClassMetadataInterface|null $parent
*
* @return void
*
* @throws MappingException * @throws MappingException
*/ */
protected function validateRuntimeMetadata($class, $parent) protected function validateRuntimeMetadata($class, $parent)
@ -226,6 +229,7 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* each class as key. * each class as key.
* *
* @param \Doctrine\ORM\Mapping\ClassMetadata $class * @param \Doctrine\ORM\Mapping\ClassMetadata $class
*
* @throws MappingException * @throws MappingException
*/ */
private function addDefaultDiscriminatorMap(ClassMetadata $class) private function addDefaultDiscriminatorMap(ClassMetadata $class)
@ -255,9 +259,10 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
} }
/** /**
* Get the lower-case short name of a class. * Gets the lower-case short name of a class.
* *
* @param string $className * @param string $className
*
* @return string * @return string
*/ */
private function getShortName($className) private function getShortName($className)
@ -275,6 +280,8 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* *
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass * @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass * @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/ */
private function addInheritedFields(ClassMetadata $subClass, ClassMetadata $parentClass) private function addInheritedFields(ClassMetadata $subClass, ClassMetadata $parentClass)
{ {
@ -297,6 +304,9 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* *
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass * @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass * @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*
* @throws MappingException * @throws MappingException
*/ */
private function addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass) private function addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass)
@ -324,8 +334,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* Adds inherited named queries to the subclass mapping. * Adds inherited named queries to the subclass mapping.
* *
* @since 2.2 * @since 2.2
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass * @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass * @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/ */
private function addInheritedNamedQueries(ClassMetadata $subClass, ClassMetadata $parentClass) private function addInheritedNamedQueries(ClassMetadata $subClass, ClassMetadata $parentClass)
{ {
@ -343,8 +356,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* Adds inherited named native queries to the subclass mapping. * Adds inherited named native queries to the subclass mapping.
* *
* @since 2.3 * @since 2.3
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass * @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass * @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/ */
private function addInheritedNamedNativeQueries(ClassMetadata $subClass, ClassMetadata $parentClass) private function addInheritedNamedNativeQueries(ClassMetadata $subClass, ClassMetadata $parentClass)
{ {
@ -365,8 +381,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* Adds inherited sql result set mappings to the subclass mapping. * Adds inherited sql result set mappings to the subclass mapping.
* *
* @since 2.3 * @since 2.3
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass * @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass * @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/ */
private function addInheritedSqlResultSetMappings(ClassMetadata $subClass, ClassMetadata $parentClass) private function addInheritedSqlResultSetMappings(ClassMetadata $subClass, ClassMetadata $parentClass)
{ {
@ -396,6 +415,9 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* most appropriate for the targeted database platform. * most appropriate for the targeted database platform.
* *
* @param ClassMetadataInfo $class * @param ClassMetadataInfo $class
*
* @return void
*
* @throws ORMException * @throws ORMException
*/ */
private function completeIdGeneratorMapping(ClassMetadataInfo $class) private function completeIdGeneratorMapping(ClassMetadataInfo $class)

File diff suppressed because it is too large Load diff

View file

@ -25,22 +25,52 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class Column implements Annotation final class Column implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var mixed */
/**
* @var mixed
*/
public $type = 'string'; public $type = 'string';
/** @var integer */
/**
* @var integer
*/
public $length; public $length;
/** @var integer */
public $precision = 0; // The precision for a decimal (exact numeric) column (Applies only for decimal column) /**
/** @var integer */ * The precision for a decimal (exact numeric) column (Applies only for decimal column).
public $scale = 0; // The scale for a decimal (exact numeric) column (Applies only for decimal column) *
/** @var boolean */ * @var integer
*/
public $precision = 0;
/**
* The scale for a decimal (exact numeric) column (Applies only for decimal column).
*
* @var integer
*/
public $scale = 0;
/**
* @var boolean
*/
public $unique = false; public $unique = false;
/** @var boolean */
/**
* @var boolean
*/
public $nullable = false; public $nullable = false;
/** @var array */
/**
* @var array
*/
public $options = array(); public $options = array();
/** @var string */
/**
* @var string
*/
public $columnDefinition; public $columnDefinition;
} }

View file

@ -31,12 +31,10 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class ColumnResult implements Annotation final class ColumnResult implements Annotation
{ {
/** /**
* The name of a column in the SELECT clause of a SQL query * The name of a column in the SELECT clause of a SQL query.
* *
* @var string * @var string
*/ */
public $name; public $name;
} }

View file

@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class CustomIdGenerator implements Annotation final class CustomIdGenerator implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $class; public $class;
} }

View file

@ -136,5 +136,4 @@ class DefaultQuoteStrategy implements QuoteStrategy
return $platform->getSQLResultCasing($columnName); return $platform->getSQLResultCasing($columnName);
} }
}
}

View file

@ -25,14 +25,30 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class DiscriminatorColumn implements Annotation final class DiscriminatorColumn implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var string */
/**
* @var string
*/
public $type; public $type;
/** @var integer */
/**
* @var integer
*/
public $length; public $length;
/** @var mixed */
public $fieldName; // field name used in non-object hydration (array/scalar) /**
/** @var string */ * Field name used in non-object hydration (array/scalar).
*
* @var mixed
*/
public $fieldName;
/**
* @var string
*/
public $columnDefinition; public $columnDefinition;
} }

View file

@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class DiscriminatorMap implements Annotation final class DiscriminatorMap implements Annotation
{ {
/** @var array<string> */ /**
* @var array<string>
*/
public $value; public $value;
} }

View file

@ -19,12 +19,12 @@
namespace Doctrine\ORM\Mapping\Driver; namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Common\Annotations\AnnotationReader, use Doctrine\Common\Annotations\AnnotationReader;
Doctrine\ORM\Mapping\MappingException, use Doctrine\ORM\Mapping\MappingException;
Doctrine\ORM\Mapping\JoinColumn, use Doctrine\ORM\Mapping\JoinColumn;
Doctrine\ORM\Mapping\Column, use Doctrine\ORM\Mapping\Column;
Doctrine\Common\Persistence\Mapping\ClassMetadata, use Doctrine\Common\Persistence\Mapping\ClassMetadata;
Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver as AbstractAnnotationDriver; use Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver as AbstractAnnotationDriver;
/** /**
* The AnnotationDriver reads the mapping metadata from docblock annotations. * The AnnotationDriver reads the mapping metadata from docblock annotations.
@ -471,10 +471,12 @@ class AnnotationDriver extends AbstractAnnotationDriver
/** /**
* Attempts to resolve the fetch mode. * Attempts to resolve the fetch mode.
* *
* @param string $className The class name * @param string $className The class name.
* @param string $fetchMode The fetch mode * @param string $fetchMode The fetch mode.
* @return integer The fetch mode as defined in ClassMetadata *
* @throws MappingException If the fetch mode is not valid * @return integer The fetch mode as defined in ClassMetadata.
*
* @throws MappingException If the fetch mode is not valid.
*/ */
private function getFetchMode($className, $fetchMode) private function getFetchMode($className, $fetchMode)
{ {
@ -486,10 +488,11 @@ class AnnotationDriver extends AbstractAnnotationDriver
} }
/** /**
* Parse the given JoinColumn as array * Parses the given JoinColumn as array.
* *
* @param JoinColumn $joinColumn * @param JoinColumn $joinColumn
* @return array *
* @return array
*/ */
private function joinColumnToArray(JoinColumn $joinColumn) private function joinColumnToArray(JoinColumn $joinColumn)
{ {
@ -506,9 +509,10 @@ class AnnotationDriver extends AbstractAnnotationDriver
/** /**
* Parse the given Column as array * Parse the given Column as array
* *
* @param string $fieldName * @param string $fieldName
* @param Column $column * @param Column $column
* @return array *
* @return array
*/ */
private function columnToArray($fieldName, Column $column) private function columnToArray($fieldName, Column $column)
{ {
@ -538,10 +542,11 @@ class AnnotationDriver extends AbstractAnnotationDriver
} }
/** /**
* Factory method for the Annotation Driver * Factory method for the Annotation Driver.
*
* @param array|string $paths
* @param AnnotationReader|null $reader
* *
* @param array|string $paths
* @param AnnotationReader $reader
* @return AnnotationDriver * @return AnnotationDriver
*/ */
static public function create($paths = array(), AnnotationReader $reader = null) static public function create($paths = array(), AnnotationReader $reader = null)

View file

@ -19,18 +19,17 @@
namespace Doctrine\ORM\Mapping\Driver; namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\DBAL\Schema\AbstractSchemaManager, use Doctrine\DBAL\Schema\AbstractSchemaManager;
Doctrine\DBAL\Schema\SchemaException, use Doctrine\DBAL\Schema\SchemaException;
Doctrine\Common\Persistence\Mapping\Driver\MappingDriver, use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
Doctrine\Common\Persistence\Mapping\ClassMetadata, use Doctrine\Common\Persistence\Mapping\ClassMetadata;
Doctrine\ORM\Mapping\ClassMetadataInfo, use Doctrine\ORM\Mapping\ClassMetadataInfo;
Doctrine\Common\Util\Inflector, use Doctrine\Common\Util\Inflector;
Doctrine\ORM\Mapping\MappingException; use Doctrine\ORM\Mapping\MappingException;
/** /**
* The DatabaseDriver reverse engineers the mapping metadata from a database. * The DatabaseDriver reverse engineers the mapping metadata from a database.
* *
*
* @link www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
@ -45,10 +44,13 @@ class DatabaseDriver implements MappingDriver
private $_sm; private $_sm;
/** /**
* @var array * @var array|null
*/ */
private $tables = null; private $tables = null;
/**
* @var array
*/
private $classToTableNames = array(); private $classToTableNames = array();
/** /**
@ -69,12 +71,11 @@ class DatabaseDriver implements MappingDriver
/** /**
* The namespace for the generated entities. * The namespace for the generated entities.
* *
* @var string * @var string|null
*/ */
private $namespace; private $namespace;
/** /**
*
* @param AbstractSchemaManager $schemaManager * @param AbstractSchemaManager $schemaManager
*/ */
public function __construct(AbstractSchemaManager $schemaManager) public function __construct(AbstractSchemaManager $schemaManager)
@ -83,10 +84,11 @@ class DatabaseDriver implements MappingDriver
} }
/** /**
* Set tables manually instead of relying on the reverse engeneering capabilities of SchemaManager. * Sets tables manually instead of relying on the reverse engeneering capabilities of SchemaManager.
* *
* @param array $entityTables * @param array $entityTables
* @param array $manyToManyTables * @param array $manyToManyTables
*
* @return void * @return void
*/ */
public function setTables($entityTables, $manyToManyTables) public function setTables($entityTables, $manyToManyTables)
@ -102,6 +104,11 @@ class DatabaseDriver implements MappingDriver
} }
} }
/**
* @return void
*
* @throws \Doctrine\ORM\Mapping\MappingException
*/
private function reverseEngineerMappingFromDatabase() private function reverseEngineerMappingFromDatabase()
{ {
if ($this->tables !== null) { if ($this->tables !== null) {
@ -340,10 +347,11 @@ class DatabaseDriver implements MappingDriver
} }
/** /**
* Set class name for a table. * Sets class name for a table.
* *
* @param string $tableName * @param string $tableName
* @param string $className * @param string $className
*
* @return void * @return void
*/ */
public function setClassNameForTable($tableName, $className) public function setClassNameForTable($tableName, $className)
@ -352,11 +360,12 @@ class DatabaseDriver implements MappingDriver
} }
/** /**
* Set field name for a column on a specific table. * Sets field name for a column on a specific table.
* *
* @param string $tableName * @param string $tableName
* @param string $columnName * @param string $columnName
* @param string $fieldName * @param string $fieldName
*
* @return void * @return void
*/ */
public function setFieldNameForColumn($tableName, $columnName, $fieldName) public function setFieldNameForColumn($tableName, $columnName, $fieldName)
@ -365,9 +374,10 @@ class DatabaseDriver implements MappingDriver
} }
/** /**
* Return the mapped class name for a table if it exists. Otherwise return "classified" version. * Returns the mapped class name for a table if it exists. Otherwise return "classified" version.
* *
* @param string $tableName * @param string $tableName
*
* @return string * @return string
*/ */
private function getClassNameForTable($tableName) private function getClassNameForTable($tableName)
@ -382,9 +392,10 @@ class DatabaseDriver implements MappingDriver
/** /**
* Return the mapped field name for a column, if it exists. Otherwise return camelized version. * Return the mapped field name for a column, if it exists. Otherwise return camelized version.
* *
* @param string $tableName * @param string $tableName
* @param string $columnName * @param string $columnName
* @param boolean $fk Whether the column is a foreignkey or not. * @param boolean $fk Whether the column is a foreignkey or not.
*
* @return string * @return string
*/ */
private function getFieldNameForColumn($tableName, $columnName, $fk = false) private function getFieldNameForColumn($tableName, $columnName, $fk = false)
@ -406,6 +417,7 @@ class DatabaseDriver implements MappingDriver
* Set the namespace for the generated entities. * Set the namespace for the generated entities.
* *
* @param string $namespace * @param string $namespace
*
* @return void * @return void
*/ */
public function setNamespace($namespace) public function setNamespace($namespace)

View file

@ -28,4 +28,4 @@ use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain;
*/ */
class DriverChain extends MappingDriverChain class DriverChain extends MappingDriverChain
{ {
} }

View file

@ -28,4 +28,4 @@ use Doctrine\Common\Persistence\Mapping\Driver\PHPDriver as CommonPHPDriver;
*/ */
class PHPDriver extends CommonPHPDriver class PHPDriver extends CommonPHPDriver
{ {
} }

View file

@ -28,4 +28,4 @@ use Doctrine\Common\Persistence\Mapping\Driver\StaticPHPDriver as CommonStaticPH
*/ */
class StaticPHPDriver extends CommonStaticPHPDriver class StaticPHPDriver extends CommonStaticPHPDriver
{ {
} }

View file

@ -552,7 +552,8 @@ class XmlDriver extends FileDriver
/** /**
* Parses (nested) option elements. * Parses (nested) option elements.
* *
* @param SimpleXMLElement $options the XML element. * @param SimpleXMLElement $options The XML element.
*
* @return array The options array. * @return array The options array.
*/ */
private function _parseOptions(SimpleXMLElement $options) private function _parseOptions(SimpleXMLElement $options)
@ -583,7 +584,8 @@ class XmlDriver extends FileDriver
* Constructs a joinColumn mapping array based on the information * Constructs a joinColumn mapping array based on the information
* found in the given SimpleXMLElement. * found in the given SimpleXMLElement.
* *
* @param SimpleXMLElement $joinColumnElement the XML element. * @param SimpleXMLElement $joinColumnElement The XML element.
*
* @return array The mapping array. * @return array The mapping array.
*/ */
private function joinColumnToArray(SimpleXMLElement $joinColumnElement) private function joinColumnToArray(SimpleXMLElement $joinColumnElement)
@ -613,10 +615,11 @@ class XmlDriver extends FileDriver
} }
/** /**
* Parse the given field as array * Parses the given field as array.
* *
* @param SimpleXMLElement $fieldMapping * @param SimpleXMLElement $fieldMapping
* @return array *
* @return array
*/ */
private function columnToArray(SimpleXMLElement $fieldMapping) private function columnToArray(SimpleXMLElement $fieldMapping)
{ {
@ -670,7 +673,8 @@ class XmlDriver extends FileDriver
/** /**
* Gathers a list of cascade options found in the given cascade element. * Gathers a list of cascade options found in the given cascade element.
* *
* @param SimpleXMLElement $cascadeElement the cascade element. * @param SimpleXMLElement $cascadeElement The cascade element.
*
* @return array The list of cascade options. * @return array The list of cascade options.
*/ */
private function _getCascadeMappings($cascadeElement) private function _getCascadeMappings($cascadeElement)
@ -711,6 +715,11 @@ class XmlDriver extends FileDriver
return $result; return $result;
} }
/**
* @param mixed $element
*
* @return bool
*/
protected function evaluateBoolean($element) protected function evaluateBoolean($element)
{ {
$flag = (string)$element; $flag = (string)$element;
@ -718,4 +727,3 @@ class XmlDriver extends FileDriver
return ($flag === true || $flag == "true" || $flag == "1"); return ($flag === true || $flag == "true" || $flag == "1");
} }
} }

View file

@ -19,10 +19,10 @@
namespace Doctrine\ORM\Mapping\Driver; namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Common\Persistence\Mapping\ClassMetadata, use Doctrine\Common\Persistence\Mapping\ClassMetadata;
Doctrine\Common\Persistence\Mapping\Driver\FileDriver, use Doctrine\Common\Persistence\Mapping\Driver\FileDriver;
Doctrine\ORM\Mapping\MappingException, use Doctrine\ORM\Mapping\MappingException;
Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
/** /**
* The YamlDriver reads the mapping metadata from yaml schema files. * The YamlDriver reads the mapping metadata from yaml schema files.
@ -574,7 +574,8 @@ class YamlDriver extends FileDriver
* Constructs a joinColumn mapping array based on the information * Constructs a joinColumn mapping array based on the information
* found in the given join column element. * found in the given join column element.
* *
* @param array $joinColumnElement The array join column element * @param array $joinColumnElement The array join column element.
*
* @return array The mapping array. * @return array The mapping array.
*/ */
private function joinColumnToArray($joinColumnElement) private function joinColumnToArray($joinColumnElement)
@ -612,10 +613,11 @@ class YamlDriver extends FileDriver
} }
/** /**
* Parse the given column as array * Parses the given column as array.
*
* @param string $fieldName
* @param array $column
* *
* @param string $fieldName
* @param array $column
* @return array * @return array
*/ */
private function columnToArray($fieldName, $column) private function columnToArray($fieldName, $column)

View file

@ -26,6 +26,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class ElementCollection implements Annotation final class ElementCollection implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $tableName; public $tableName;
} }

View file

@ -25,8 +25,13 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class Entity implements Annotation final class Entity implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $repositoryClass; public $repositoryClass;
/** @var boolean */
/**
* @var boolean
*/
public $readOnly = false; public $readOnly = false;
} }

View file

@ -33,9 +33,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class EntityResult implements Annotation final class EntityResult implements Annotation
{ {
/** /**
* The class of the result * The class of the result.
* *
* @var string * @var string
*/ */
@ -54,5 +53,4 @@ final class EntityResult implements Annotation
* @var string * @var string
*/ */
public $discriminatorColumn; public $discriminatorColumn;
} }

View file

@ -30,7 +30,6 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class FieldResult implements Annotation final class FieldResult implements Annotation
{ {
/** /**
* Name of the column in the SELECT clause. * Name of the column in the SELECT clause.
* *
@ -39,10 +38,9 @@ final class FieldResult implements Annotation
public $name; public $name;
/** /**
* Name of the persistent field or property of the class. * Name of the persistent field or property of the class.
* *
* @var string * @var string
*/ */
public $column; public $column;
} }

View file

@ -26,7 +26,9 @@ namespace Doctrine\ORM\Mapping;
final class GeneratedValue implements Annotation final class GeneratedValue implements Annotation
{ {
/** /**
* @var string The type of Id generator. * The type of Id generator.
*
* @var string
* *
* @Enum({"AUTO", "SEQUENCE", "TABLE", "IDENTITY", "NONE", "UUID", "CUSTOM"}) * @Enum({"AUTO", "SEQUENCE", "TABLE", "IDENTITY", "NONE", "UUID", "CUSTOM"})
*/ */

View file

@ -25,8 +25,13 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class Index implements Annotation final class Index implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var array<string> */
/**
* @var array<string>
*/
public $columns; public $columns;
} }

View file

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

View file

@ -25,18 +25,40 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class JoinColumn implements Annotation final class JoinColumn implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var string */
/**
* @var string
*/
public $referencedColumnName = 'id'; public $referencedColumnName = 'id';
/** @var boolean */
/**
* @var boolean
*/
public $unique = false; public $unique = false;
/** @var boolean */
/**
* @var boolean
*/
public $nullable = true; public $nullable = true;
/** @var mixed */
/**
* @var mixed
*/
public $onDelete; public $onDelete;
/** @var string */
/**
* @var string
*/
public $columnDefinition; public $columnDefinition;
/** @var string */
public $fieldName; // field name used in non-object hydration (array/scalar) /**
* Field name used in non-object hydration (array/scalar).
*
* @var string
*/
public $fieldName;
} }

View file

@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class JoinColumns implements Annotation final class JoinColumns implements Annotation
{ {
/** @var array<\Doctrine\ORM\Mapping\JoinColumn> */ /**
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
*/
public $value; public $value;
} }

View file

@ -25,12 +25,23 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class JoinTable implements Annotation final class JoinTable implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var string */
/**
* @var string
*/
public $schema; public $schema;
/** @var array<\Doctrine\ORM\Mapping\JoinColumn> */
/**
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
*/
public $joinColumns = array(); public $joinColumns = array();
/** @var array<\Doctrine\ORM\Mapping\JoinColumn> */
/**
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
*/
public $inverseJoinColumns = array(); public $inverseJoinColumns = array();
} }

View file

@ -46,7 +46,9 @@ final class ManyToMany implements Annotation
public $cascade; public $cascade;
/** /**
* @var string The fetching strategy to use for the association. * The fetching strategy to use for the association.
*
* @var string
* *
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"}) * @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
*/ */

View file

@ -36,7 +36,9 @@ final class ManyToOne implements Annotation
public $cascade; public $cascade;
/** /**
* @var string The fetching strategy to use for the association. * The fetching strategy to use for the association.
*
* @var string
* *
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"}) * @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
*/ */

View file

@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class MappedSuperclass implements Annotation final class MappedSuperclass implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $repositoryClass; public $repositoryClass;
} }

View file

@ -26,12 +26,20 @@ namespace Doctrine\ORM\Mapping;
*/ */
class MappingException extends \Doctrine\ORM\ORMException class MappingException extends \Doctrine\ORM\ORMException
{ {
/**
* @return MappingException
*/
public static function pathRequired() public static function pathRequired()
{ {
return new self("Specifying the paths to your entities is required ". return new self("Specifying the paths to your entities is required ".
"in the AnnotationDriver to retrieve all class names."); "in the AnnotationDriver to retrieve all class names.");
} }
/**
* @param string $entityName
*
* @return MappingException
*/
public static function identifierRequired($entityName) public static function identifierRequired($entityName)
{ {
if (false !== ($parent = get_parent_class($entityName))) { if (false !== ($parent = get_parent_class($entityName))) {
@ -48,41 +56,73 @@ class MappingException extends \Doctrine\ORM\ORMException
} }
/**
* @param string $entityName
* @param string $type
*
* @return MappingException
*/
public static function invalidInheritanceType($entityName, $type) public static function invalidInheritanceType($entityName, $type)
{ {
return new self("The inheritance type '$type' specified for '$entityName' does not exist."); return new self("The inheritance type '$type' specified for '$entityName' does not exist.");
} }
/**
* @return MappingException
*/
public static function generatorNotAllowedWithCompositeId() public static function generatorNotAllowedWithCompositeId()
{ {
return new self("Id generators can't be used with a composite id."); return new self("Id generators can't be used with a composite id.");
} }
/**
* @param string $entity
*
* @return MappingException
*/
public static function missingFieldName($entity) public static function missingFieldName($entity)
{ {
return new self("The field or association mapping misses the 'fieldName' attribute in entity '$entity'."); return new self("The field or association mapping misses the 'fieldName' attribute in entity '$entity'.");
} }
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function missingTargetEntity($fieldName) public static function missingTargetEntity($fieldName)
{ {
return new self("The association mapping '$fieldName' misses the 'targetEntity' attribute."); return new self("The association mapping '$fieldName' misses the 'targetEntity' attribute.");
} }
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function missingSourceEntity($fieldName) public static function missingSourceEntity($fieldName)
{ {
return new self("The association mapping '$fieldName' misses the 'sourceEntity' attribute."); return new self("The association mapping '$fieldName' misses the 'sourceEntity' attribute.");
} }
/**
* @param string $entityName
* @param string $fileName
*
* @return MappingException
*/
public static function mappingFileNotFound($entityName, $fileName) public static function mappingFileNotFound($entityName, $fileName)
{ {
return new self("No mapping file found named '$fileName' for class '$entityName'."); return new self("No mapping file found named '$fileName' for class '$entityName'.");
} }
/** /**
* Exception for invalid property name override. * Exception for invalid property name override.
* *
* @param string $className The entity's name * @param string $className The entity's name.
* @param string $fieldName * @param string $fieldName
*
* @return MappingException
*/ */
public static function invalidOverrideFieldName($className, $fieldName) public static function invalidOverrideFieldName($className, $fieldName)
{ {
@ -92,64 +132,128 @@ class MappingException extends \Doctrine\ORM\ORMException
/** /**
* Exception for invalid property type override. * Exception for invalid property type override.
* *
* @param string $className The entity's name * @param string $className The entity's name.
* @param string $fieldName * @param string $fieldName
*
* @return MappingException
*/ */
public static function invalidOverrideFieldType($className, $fieldName) public static function invalidOverrideFieldType($className, $fieldName)
{ {
return new self("The column type of attribute '$fieldName' on class '$className' could not be changed."); return new self("The column type of attribute '$fieldName' on class '$className' could not be changed.");
} }
/**
* @param string $className
* @param string $fieldName
*
* @return MappingException
*/
public static function mappingNotFound($className, $fieldName) public static function mappingNotFound($className, $fieldName)
{ {
return new self("No mapping found for field '$fieldName' on class '$className'."); return new self("No mapping found for field '$fieldName' on class '$className'.");
} }
/**
* @param string $className
* @param string $queryName
*
* @return MappingException
*/
public static function queryNotFound($className, $queryName) public static function queryNotFound($className, $queryName)
{ {
return new self("No query found named '$queryName' on class '$className'."); return new self("No query found named '$queryName' on class '$className'.");
} }
/**
* @param string $className
* @param string $resultName
*
* @return MappingException
*/
public static function resultMappingNotFound($className, $resultName) public static function resultMappingNotFound($className, $resultName)
{ {
return new self("No result set mapping found named '$resultName' on class '$className'."); return new self("No result set mapping found named '$resultName' on class '$className'.");
} }
/**
* @param string $entity
* @param string $queryName
*
* @return MappingException
*/
public static function emptyQueryMapping($entity, $queryName) public static function emptyQueryMapping($entity, $queryName)
{ {
return new self('Query named "'.$queryName.'" in "'.$entity.'" could not be empty.'); return new self('Query named "'.$queryName.'" in "'.$entity.'" could not be empty.');
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function nameIsMandatoryForQueryMapping($className) public static function nameIsMandatoryForQueryMapping($className)
{ {
return new self("Query name on entity class '$className' is not defined."); return new self("Query name on entity class '$className' is not defined.");
} }
/**
* @param string $entity
* @param string $queryName
*
* @return MappingException
*/
public static function missingQueryMapping($entity, $queryName) public static function missingQueryMapping($entity, $queryName)
{ {
return new self('Query named "'.$queryName.'" in "'.$entity.' requires a result class or result set mapping.'); return new self('Query named "'.$queryName.'" in "'.$entity.' requires a result class or result set mapping.');
} }
/**
* @param string $entity
* @param string $resultName
*
* @return MappingException
*/
public static function missingResultSetMappingEntity($entity, $resultName) public static function missingResultSetMappingEntity($entity, $resultName)
{ {
return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a entity class name.'); return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a entity class name.');
} }
/**
* @param string $entity
* @param string $resultName
*
* @return MappingException
*/
public static function missingResultSetMappingFieldName($entity, $resultName) public static function missingResultSetMappingFieldName($entity, $resultName)
{ {
return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a field name.'); return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a field name.');
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function nameIsMandatoryForSqlResultSetMapping($className) public static function nameIsMandatoryForSqlResultSetMapping($className)
{ {
return new self("Result set mapping name on entity class '$className' is not defined."); return new self("Result set mapping name on entity class '$className' is not defined.");
} }
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function oneToManyRequiresMappedBy($fieldName) public static function oneToManyRequiresMappedBy($fieldName)
{ {
return new self("OneToMany mapping on field '$fieldName' requires the 'mappedBy' attribute."); return new self("OneToMany mapping on field '$fieldName' requires the 'mappedBy' attribute.");
} }
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function joinTableRequired($fieldName) public static function joinTableRequired($fieldName)
{ {
return new self("The mapping of field '$fieldName' requires an the 'joinTable' attribute."); return new self("The mapping of field '$fieldName' requires an the 'joinTable' attribute.");
@ -158,10 +262,11 @@ class MappingException extends \Doctrine\ORM\ORMException
/** /**
* Called if a required option was not found but is required * Called if a required option was not found but is required
* *
* @param string $field which field cannot be processed? * @param string $field Which field cannot be processed?
* @param string $expectedOption which option is required * @param string $expectedOption Which option is required
* @param string $hint Can optionally be used to supply a tip for common mistakes, * @param string $hint Can optionally be used to supply a tip for common mistakes,
* e.g. "Did you think of the plural s?" * e.g. "Did you think of the plural s?"
*
* @return MappingException * @return MappingException
*/ */
static function missingRequiredOption($field, $expectedOption, $hint = '') static function missingRequiredOption($field, $expectedOption, $hint = '')
@ -179,6 +284,8 @@ class MappingException extends \Doctrine\ORM\ORMException
* Generic exception for invalid mappings. * Generic exception for invalid mappings.
* *
* @param string $fieldName * @param string $fieldName
*
* @return MappingException
*/ */
public static function invalidMapping($fieldName) public static function invalidMapping($fieldName)
{ {
@ -190,20 +297,33 @@ class MappingException extends \Doctrine\ORM\ORMException
* because there might be long classnames that will be shortened * because there might be long classnames that will be shortened
* within the stacktrace * within the stacktrace
* *
* @param string $entity The entity's name * @param string $entity The entity's name
* @param \ReflectionException $previousException * @param \ReflectionException $previousException
*
* @return MappingException
*/ */
public static function reflectionFailure($entity, \ReflectionException $previousException) public static function reflectionFailure($entity, \ReflectionException $previousException)
{ {
return new self('An error occurred in ' . $entity, 0, $previousException); return new self('An error occurred in ' . $entity, 0, $previousException);
} }
/**
* @param string $className
* @param string $joinColumn
*
* @return MappingException
*/
public static function joinColumnMustPointToMappedField($className, $joinColumn) public static function joinColumnMustPointToMappedField($className, $joinColumn)
{ {
return new self('The column ' . $joinColumn . ' must be mapped to a field in class ' return new self('The column ' . $joinColumn . ' must be mapped to a field in class '
. $className . ' since it is referenced by a join column of another class.'); . $className . ' since it is referenced by a join column of another class.');
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function classIsNotAValidEntityOrMappedSuperClass($className) public static function classIsNotAValidEntityOrMappedSuperClass($className)
{ {
if (false !== ($parent = get_parent_class($className))) { if (false !== ($parent = get_parent_class($className))) {
@ -219,45 +339,88 @@ class MappingException extends \Doctrine\ORM\ORMException
)); ));
} }
/**
* @param string $className
* @param string $propertyName
*
* @return MappingException
*/
public static function propertyTypeIsRequired($className, $propertyName) public static function propertyTypeIsRequired($className, $propertyName)
{ {
return new self("The attribute 'type' is required for the column description of property ".$className."::\$".$propertyName."."); return new self("The attribute 'type' is required for the column description of property ".$className."::\$".$propertyName.".");
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function tableIdGeneratorNotImplemented($className) public static function tableIdGeneratorNotImplemented($className)
{ {
return new self("TableIdGenerator is not yet implemented for use with class ".$className); return new self("TableIdGenerator is not yet implemented for use with class ".$className);
} }
/** /**
* @param string $entity The entity's name * @param string $entity The entity's name.
* @param string $fieldName The name of the field that was already declared * @param string $fieldName The name of the field that was already declared.
*
* @return MappingException
*/ */
public static function duplicateFieldMapping($entity, $fieldName) public static function duplicateFieldMapping($entity, $fieldName)
{ {
return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once'); return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once');
} }
/**
* @param string $entity
* @param string $fieldName
*
* @return MappingException
*/
public static function duplicateAssociationMapping($entity, $fieldName) public static function duplicateAssociationMapping($entity, $fieldName)
{ {
return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once'); return new self('Property "'.$fieldName.'" in "'.$entity.'" was already declared, but it must be declared only once');
} }
/**
* @param string $entity
* @param string $queryName
*
* @return MappingException
*/
public static function duplicateQueryMapping($entity, $queryName) public static function duplicateQueryMapping($entity, $queryName)
{ {
return new self('Query named "'.$queryName.'" in "'.$entity.'" was already declared, but it must be declared only once'); return new self('Query named "'.$queryName.'" in "'.$entity.'" was already declared, but it must be declared only once');
} }
/**
* @param string $entity
* @param string $resultName
*
* @return MappingException
*/
public static function duplicateResultSetMapping($entity, $resultName) public static function duplicateResultSetMapping($entity, $resultName)
{ {
return new self('Result set mapping named "'.$resultName.'" in "'.$entity.'" was already declared, but it must be declared only once'); return new self('Result set mapping named "'.$resultName.'" in "'.$entity.'" was already declared, but it must be declared only once');
} }
/**
* @param string $entity
*
* @return MappingException
*/
public static function singleIdNotAllowedOnCompositePrimaryKey($entity) public static function singleIdNotAllowedOnCompositePrimaryKey($entity)
{ {
return new self('Single id is not allowed on composite primary key in entity '.$entity); return new self('Single id is not allowed on composite primary key in entity '.$entity);
} }
/**
* @param string $entity
* @param string $fieldName
* @param string $unsupportedType
*
* @return MappingException
*/
public static function unsupportedOptimisticLockingType($entity, $fieldName, $unsupportedType) public static function unsupportedOptimisticLockingType($entity, $fieldName, $unsupportedType)
{ {
return new self('Locking type "'.$unsupportedType.'" (specified in "'.$entity.'", field "'.$fieldName.'") ' return new self('Locking type "'.$unsupportedType.'" (specified in "'.$entity.'", field "'.$fieldName.'") '
@ -265,6 +428,11 @@ class MappingException extends \Doctrine\ORM\ORMException
); );
} }
/**
* @param string|null $path
*
* @return MappingException
*/
public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null) public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null)
{ {
if ( ! empty($path)) { if ( ! empty($path)) {
@ -278,12 +446,13 @@ class MappingException extends \Doctrine\ORM\ORMException
} }
/** /**
* Throws an exception that indicates that a class used in a discriminator map does not exist. * Returns an exception that indicates that a class used in a discriminator map does not exist.
* An example would be an outdated (maybe renamed) classname. * An example would be an outdated (maybe renamed) classname.
* *
* @param string $className The class that could not be found * @param string $className The class that could not be found
* @param string $owningClass The class that declares the discriminator map. * @param string $owningClass The class that declares the discriminator map.
* @return self *
* @return MappingException
*/ */
public static function invalidClassInDiscriminatorMap($className, $owningClass) public static function invalidClassInDiscriminatorMap($className, $owningClass)
{ {
@ -293,6 +462,13 @@ class MappingException extends \Doctrine\ORM\ORMException
); );
} }
/**
* @param string $className
* @param array $entries
* @param array $map
*
* @return MappingException
*/
public static function duplicateDiscriminatorEntry($className, array $entries, array $map) public static function duplicateDiscriminatorEntry($className, array $entries, array $map)
{ {
return new self( return new self(
@ -304,46 +480,87 @@ class MappingException extends \Doctrine\ORM\ORMException
); );
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function missingDiscriminatorMap($className) public static function missingDiscriminatorMap($className)
{ {
return new self("Entity class '$className' is using inheritance but no discriminator map was defined."); return new self("Entity class '$className' is using inheritance but no discriminator map was defined.");
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function missingDiscriminatorColumn($className) public static function missingDiscriminatorColumn($className)
{ {
return new self("Entity class '$className' is using inheritance but no discriminator column was defined."); return new self("Entity class '$className' is using inheritance but no discriminator column was defined.");
} }
/**
* @param string $className
* @param string $type
*
* @return MappingException
*/
public static function invalidDiscriminatorColumnType($className, $type) public static function invalidDiscriminatorColumnType($className, $type)
{ {
return new self("Discriminator column type on entity class '$className' is not allowed to be '$type'. 'string' or 'integer' type variables are suggested!"); return new self("Discriminator column type on entity class '$className' is not allowed to be '$type'. 'string' or 'integer' type variables are suggested!");
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function nameIsMandatoryForDiscriminatorColumns($className) public static function nameIsMandatoryForDiscriminatorColumns($className)
{ {
return new self("Discriminator column name on entity class '$className' is not defined."); return new self("Discriminator column name on entity class '$className' is not defined.");
} }
/**
* @param string $className
* @param string $fieldName
*
* @return MappingException
*/
public static function cannotVersionIdField($className, $fieldName) public static function cannotVersionIdField($className, $fieldName)
{ {
return new self("Setting Id field '$fieldName' as versionale in entity class '$className' is not supported."); return new self("Setting Id field '$fieldName' as versionale in entity class '$className' is not supported.");
} }
/**
* @param string $className
* @param string $fieldName
* @param string $type
*
* @return MappingException
*/
public static function sqlConversionNotAllowedForIdentifiers($className, $fieldName, $type) public static function sqlConversionNotAllowedForIdentifiers($className, $fieldName, $type)
{ {
return new self("It is not possible to set id field '$fieldName' to type '$type' in entity class '$className'. The type '$type' requires conversion SQL which is not allowed for identifiers."); return new self("It is not possible to set id field '$fieldName' to type '$type' in entity class '$className'. The type '$type' requires conversion SQL which is not allowed for identifiers.");
} }
/** /**
* @param string $className * @param string $className
* @param string $columnName * @param string $columnName
* @return self *
* @return MappingException
*/ */
public static function duplicateColumnName($className, $columnName) public static function duplicateColumnName($className, $columnName)
{ {
return new self("Duplicate definition of column '".$columnName."' on entity '".$className."' in a field or discriminator column mapping."); return new self("Duplicate definition of column '".$columnName."' on entity '".$className."' in a field or discriminator column mapping.");
} }
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalToManyAssocationOnMappedSuperclass($className, $field) public static function illegalToManyAssocationOnMappedSuperclass($className, $field)
{ {
return new self("It is illegal to put an inverse side one-to-many or many-to-many association on mapped superclass '".$className."#".$field."'."); return new self("It is illegal to put an inverse side one-to-many or many-to-many association on mapped superclass '".$className."#".$field."'.");
@ -353,7 +570,8 @@ class MappingException extends \Doctrine\ORM\ORMException
* @param string $className * @param string $className
* @param string $targetEntity * @param string $targetEntity
* @param string $targetField * @param string $targetField
* @return self *
* @return MappingException
*/ */
public static function cannotMapCompositePrimaryKeyEntitiesAsForeignId($className, $targetEntity, $targetField) public static function cannotMapCompositePrimaryKeyEntitiesAsForeignId($className, $targetEntity, $targetField)
{ {
@ -361,44 +579,91 @@ class MappingException extends \Doctrine\ORM\ORMException
"as part of the primary key of another entity '".$targetEntity."#".$targetField."'."); "as part of the primary key of another entity '".$targetEntity."#".$targetField."'.");
} }
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function noSingleAssociationJoinColumnFound($className, $field) public static function noSingleAssociationJoinColumnFound($className, $field)
{ {
return new self("'$className#$field' is not an association with a single join column."); return new self("'$className#$field' is not an association with a single join column.");
} }
/**
* @param string $className
* @param string $column
*
* @return MappingException
*/
public static function noFieldNameFoundForColumn($className, $column) public static function noFieldNameFoundForColumn($className, $column)
{ {
return new self("Cannot find a field on '$className' that is mapped to column '$column'. Either the ". return new self("Cannot find a field on '$className' that is mapped to column '$column'. Either the ".
"field does not exist or an association exists but it has multiple join columns."); "field does not exist or an association exists but it has multiple join columns.");
} }
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalOrphanRemovalOnIdentifierAssociation($className, $field) public static function illegalOrphanRemovalOnIdentifierAssociation($className, $field)
{ {
return new self("The orphan removal option is not allowed on an association that is ". return new self("The orphan removal option is not allowed on an association that is ".
"part of the identifier in '$className#$field'."); "part of the identifier in '$className#$field'.");
} }
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalOrphanRemoval($className, $field) public static function illegalOrphanRemoval($className, $field)
{ {
return new self("Orphan removal is only allowed on one-to-one and one-to-many ". return new self("Orphan removal is only allowed on one-to-one and one-to-many ".
"associations, but " . $className."#" .$field . " is not."); "associations, but " . $className."#" .$field . " is not.");
} }
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalInverseIdentifierAssocation($className, $field) public static function illegalInverseIdentifierAssocation($className, $field)
{ {
return new self("An inverse association is not allowed to be identifier in '$className#$field'."); return new self("An inverse association is not allowed to be identifier in '$className#$field'.");
} }
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalToManyIdentifierAssoaction($className, $field) public static function illegalToManyIdentifierAssoaction($className, $field)
{ {
return new self("Many-to-many or one-to-many associations are not allowed to be identifier in '$className#$field'."); return new self("Many-to-many or one-to-many associations are not allowed to be identifier in '$className#$field'.");
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function noInheritanceOnMappedSuperClass($className) public static function noInheritanceOnMappedSuperClass($className)
{ {
return new self("Its not supported to define inheritance information on a mapped superclass '" . $className . "'."); return new self("Its not supported to define inheritance information on a mapped superclass '" . $className . "'.");
} }
/**
* @param string $className
* @param string $rootClassName
*
* @return MappingException
*/
public static function mappedClassNotPartOfDiscriminatorMap($className, $rootClassName) public static function mappedClassNotPartOfDiscriminatorMap($className, $rootClassName)
{ {
return new self( return new self(
@ -408,26 +673,57 @@ class MappingException extends \Doctrine\ORM\ORMException
); );
} }
/**
* @param string $className
* @param string $methodName
*
* @return MappingException
*/
public static function lifecycleCallbackMethodNotFound($className, $methodName) public static function lifecycleCallbackMethodNotFound($className, $methodName)
{ {
return new self("Entity '" . $className . "' has no method '" . $methodName . "' to be registered as lifecycle callback."); return new self("Entity '" . $className . "' has no method '" . $methodName . "' to be registered as lifecycle callback.");
} }
/**
* @param string $className
* @param string $annotation
*
* @return MappingException
*/
public static function invalidFetchMode($className, $annotation) public static function invalidFetchMode($className, $annotation)
{ {
return new self("Entity '" . $className . "' has a mapping with invalid fetch mode '" . $annotation . "'"); return new self("Entity '" . $className . "' has a mapping with invalid fetch mode '" . $annotation . "'");
} }
/**
* @param string $className
*
* @return MappingException
*/
public static function compositeKeyAssignedIdGeneratorRequired($className) public static function compositeKeyAssignedIdGeneratorRequired($className)
{ {
return new self("Entity '". $className . "' has a composite identifier but uses an ID generator other than manually assigning (Identity, Sequence). This is not supported."); return new self("Entity '". $className . "' has a composite identifier but uses an ID generator other than manually assigning (Identity, Sequence). This is not supported.");
} }
/**
* @param string $targetEntity
* @param string $sourceEntity
* @param string $associationName
*
* @return MappingException
*/
public static function invalidTargetEntityClass($targetEntity, $sourceEntity, $associationName) public static function invalidTargetEntityClass($targetEntity, $sourceEntity, $associationName)
{ {
return new self("The target-entity " . $targetEntity . " cannot be found in '" . $sourceEntity."#".$associationName."'."); return new self("The target-entity " . $targetEntity . " cannot be found in '" . $sourceEntity."#".$associationName."'.");
} }
/**
* @param array $cascades
* @param string $className
* @param string $propertyName
*
* @return MappingException
*/
public static function invalidCascadeOption(array $cascades, $className, $propertyName) public static function invalidCascadeOption(array $cascades, $className, $propertyName)
{ {
$cascades = implode(", ", array_map(function ($e) { return "'" . $e . "'"; }, $cascades)); $cascades = implode(", ", array_map(function ($e) { return "'" . $e . "'"; }, $cascades));

View file

@ -31,7 +31,6 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class NamedNativeQuery implements Annotation final class NamedNativeQuery implements Annotation
{ {
/** /**
* The name used to refer to the query with the EntityManager methods that create query objects. * The name used to refer to the query with the EntityManager methods that create query objects.
* *
@ -59,5 +58,4 @@ final class NamedNativeQuery implements Annotation
* @var string * @var string
*/ */
public $resultSetMapping; public $resultSetMapping;
} }

View file

@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class NamedQueries implements Annotation final class NamedQueries implements Annotation
{ {
/** @var array<\Doctrine\ORM\Mapping\NamedQuery> */ /**
* @var array<\Doctrine\ORM\Mapping\NamedQuery>
*/
public $value; public $value;
} }

View file

@ -25,8 +25,13 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class NamedQuery implements Annotation final class NamedQuery implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var string */
/**
* @var string
*/
public $query; public $query;
} }

View file

@ -31,53 +31,58 @@ namespace Doctrine\ORM\Mapping;
interface NamingStrategy interface NamingStrategy
{ {
/** /**
* Return a table name for an entity class * Returns a table name for an entity class.
* *
* @param string $className The fully-qualified class name * @param string $className The fully-qualified class name.
* @return string A table name *
* @return string A table name.
*/ */
function classToTableName($className); function classToTableName($className);
/** /**
* Return a column name for a property * Returns a column name for a property.
* *
* @param string $propertyName A property * @param string $propertyName A property name.
* @param string $className The fully-qualified class name * @param string|null $className The fully-qualified class name.
* @return string A column name *
* @return string A column name.
*/ */
function propertyToColumnName($propertyName, $className = null); function propertyToColumnName($propertyName, $className = null);
/** /**
* Return the default reference column name * Returns the default reference column name.
* *
* @return string A column name * @return string A column name.
*/ */
function referenceColumnName(); function referenceColumnName();
/** /**
* Return a join column name for a property * Returns a join column name for a property.
* *
* @param string $propertyName A property * @param string $propertyName A property name.
* @return string A join column name *
* @return string A join column name.
*/ */
function joinColumnName($propertyName); function joinColumnName($propertyName);
/** /**
* Return a join table name * Returns a join table name.
* *
* @param string $sourceEntity The source entity * @param string $sourceEntity The source entity.
* @param string $targetEntity The target entity * @param string $targetEntity The target entity.
* @param string $propertyName A property * @param string|null $propertyName A property name.
* @return string A join table name *
* @return string A join table name.
*/ */
function joinTableName($sourceEntity, $targetEntity, $propertyName = null); function joinTableName($sourceEntity, $targetEntity, $propertyName = null);
/** /**
* Return the foreign key column name for the given parameters * Returns the foreign key column name for the given parameters.
* *
* @param string $entityName A entity * @param string $entityName An entity.
* @param string $referencedColumnName A property * @param string|null $referencedColumnName A property.
* @return string A join column name *
* @return string A join column name.
*/ */
function joinKeyColumnName($entityName, $referencedColumnName = null); function joinKeyColumnName($entityName, $referencedColumnName = null);
} }

View file

@ -41,7 +41,9 @@ final class OneToMany implements Annotation
public $cascade; public $cascade;
/** /**
* @var string The fetching strategy to use for the association. * The fetching strategy to use for the association.
*
* @var string
* *
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"}) * @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
*/ */

View file

@ -46,7 +46,9 @@ final class OneToOne implements Annotation
public $cascade; public $cascade;
/** /**
* @var string The fetching strategy to use for the association. * The fetching strategy to use for the association.
*
* @var string
* *
* @Enum({"LAZY", "EAGER", "EXTRA_LAZY"}) * @Enum({"LAZY", "EAGER", "EXTRA_LAZY"})
*/ */

View file

@ -25,6 +25,8 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class OrderBy implements Annotation final class OrderBy implements Annotation
{ {
/** @var array<string> */ /**
* @var array<string>
*/
public $value; public $value;
} }

View file

@ -23,7 +23,7 @@ use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;
/** /**
* A set of rules for determining the column, alias and table quotes * A set of rules for determining the column, alias and table quotes.
* *
* @since 2.3 * @since 2.3
* @author Fabio B. Silva <fabio.bat.silva@gmail.com> * @author Fabio B. Silva <fabio.bat.silva@gmail.com>
@ -33,80 +33,88 @@ interface QuoteStrategy
/** /**
* Gets the (possibly quoted) column name for safe use in an SQL statement. * Gets the (possibly quoted) column name for safe use in an SQL statement.
* *
* @param string $fieldName * @param string $fieldName
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return string *
* @return string
*/ */
function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform); function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the (possibly quoted) primary table name for safe use in an SQL statement. * Gets the (possibly quoted) primary table name for safe use in an SQL statement.
* *
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return string *
* @return string
*/ */
function getTableName(ClassMetadata $class, AbstractPlatform $platform); function getTableName(ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the (possibly quoted) sequence name for safe use in an SQL statement. * Gets the (possibly quoted) sequence name for safe use in an SQL statement.
* *
* @param array $definition * @param array $definition
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return string *
* @return string
*/ */
function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform); function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the (possibly quoted) name of the join table. * Gets the (possibly quoted) name of the join table.
* *
* @param array $association * @param array $association
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return string *
* @return string
*/ */
function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform); function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the (possibly quoted) join column name. * Gets the (possibly quoted) join column name.
* *
* @param array $joinColumn * @param array $joinColumn
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return string *
* @return string
*/ */
function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform); function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the (possibly quoted) join column name. * Gets the (possibly quoted) join column name.
* *
* @param array $joinColumn * @param array $joinColumn
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return string *
* @return string
*/ */
function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform); function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the (possibly quoted) identifier column names for safe use in an SQL statement. * Gets the (possibly quoted) identifier column names for safe use in an SQL statement.
* *
* @param ClassMetadata $class * @param ClassMetadata $class
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @return array *
* @return array
*/ */
function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform); function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform);
/** /**
* Gets the column alias. * Gets the column alias.
* *
* @param string $columnName * @param string $columnName
* @param integer $counter * @param integer $counter
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
* @param ClassMetadata $class * @param ClassMetadata|null $class
* @return string *
* @return string
*/ */
function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null); function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null);
} }

View file

@ -25,10 +25,18 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class SequenceGenerator implements Annotation final class SequenceGenerator implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $sequenceName; public $sequenceName;
/** @var integer */
/**
* @var integer
*/
public $allocationSize = 1; public $allocationSize = 1;
/** @var integer */
/**
* @var integer
*/
public $initialValue = 1; public $initialValue = 1;
} }

View file

@ -31,7 +31,6 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class SqlResultSetMapping implements Annotation final class SqlResultSetMapping implements Annotation
{ {
/** /**
* The name given to the result set mapping, and used to refer to it in the methods of the Query API. * The name given to the result set mapping, and used to refer to it in the methods of the Query API.
* *
@ -52,5 +51,4 @@ final class SqlResultSetMapping implements Annotation
* @var array<\Doctrine\ORM\Mapping\ColumnResult> * @var array<\Doctrine\ORM\Mapping\ColumnResult>
*/ */
public $columns = array(); public $columns = array();
} }

View file

@ -25,14 +25,28 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class Table implements Annotation final class Table implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var string */
/**
* @var string
*/
public $schema; public $schema;
/** @var array<\Doctrine\ORM\Mapping\Index> */
/**
* @var array<\Doctrine\ORM\Mapping\Index>
*/
public $indexes; public $indexes;
/** @var array<\Doctrine\ORM\Mapping\UniqueConstraint> */
/**
* @var array<\Doctrine\ORM\Mapping\UniqueConstraint>
*/
public $uniqueConstraints; public $uniqueConstraints;
/** @var array */
/**
* @var array
*/
public $options = array(); public $options = array();
} }

View file

@ -37,7 +37,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
private $case; private $case;
/** /**
* Underscore naming strategy construct * Underscore naming strategy construct.
* *
* @param integer $case CASE_LOWER | CASE_UPPER * @param integer $case CASE_LOWER | CASE_UPPER
*/ */
@ -47,7 +47,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
} }
/** /**
* @return integer * @return integer CASE_LOWER | CASE_UPPER
*/ */
public function getCase() public function getCase()
{ {
@ -55,10 +55,12 @@ class UnderscoreNamingStrategy implements NamingStrategy
} }
/** /**
* Sets string case CASE_LOWER | CASE_UPPER * Sets string case CASE_LOWER | CASE_UPPER.
* Alphabetic characters converted to lowercase or uppercase * Alphabetic characters converted to lowercase or uppercase.
* *
* @param integer $case * @param integer $case
*
* @return void
*/ */
public function setCase($case) public function setCase($case)
{ {
@ -120,6 +122,7 @@ class UnderscoreNamingStrategy implements NamingStrategy
/** /**
* @param string $string * @param string $string
*
* @return string * @return string
*/ */
private function underscore($string) private function underscore($string)

View file

@ -25,8 +25,13 @@ namespace Doctrine\ORM\Mapping;
*/ */
final class UniqueConstraint implements Annotation final class UniqueConstraint implements Annotation
{ {
/** @var string */ /**
* @var string
*/
public $name; public $name;
/** @var array<string> */
/**
* @var array<string>
*/
public $columns; public $columns;
} }