1
0
mirror of synced 2024-12-05 03:06:05 +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
{
/**
* The name of the relationship property whose mapping is being overridden
* The name of the relationship property whose mapping is being overridden.
*
* @var string
*/
@ -45,12 +44,10 @@ final class AssociationOverride implements Annotation
*/
public $joinColumns;
/**
* The join table that maps the relationship.
*
* @var \Doctrine\ORM\Mapping\JoinTable
*/
public $joinTable;
}

View File

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

View File

@ -30,7 +30,6 @@ namespace Doctrine\ORM\Mapping;
*/
final class AttributeOverride implements Annotation
{
/**
* 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
{
/**
* One or more field or property mapping overrides.
*
* @var array<\Doctrine\ORM\Mapping\AttributeOverride>
*/
public $value;
}

View File

@ -34,19 +34,19 @@ class AssociationBuilder
protected $mapping;
/**
* @var array
* @var array|null
*/
protected $joinColumns;
/**
*
* @var int
*/
protected $type;
/**
* @param ClassMetadataBuilder $builder
* @param array $mapping
* @param array $mapping
* @param int $type
*/
public function __construct(ClassMetadataBuilder $builder, array $mapping, $type)
{
@ -55,66 +55,103 @@ class AssociationBuilder
$this->type = $type;
}
/**
* @param string $fieldName
*
* @return AssociationBuilder
*/
public function mappedBy($fieldName)
{
$this->mapping['mappedBy'] = $fieldName;
return $this;
}
/**
* @param string $fieldName
*
* @return AssociationBuilder
*/
public function inversedBy($fieldName)
{
$this->mapping['inversedBy'] = $fieldName;
return $this;
}
/**
* @return AssociationBuilder
*/
public function cascadeAll()
{
$this->mapping['cascade'] = array("ALL");
return $this;
}
/**
* @return AssociationBuilder
*/
public function cascadePersist()
{
$this->mapping['cascade'][] = "persist";
return $this;
}
/**
* @return AssociationBuilder
*/
public function cascadeRemove()
{
$this->mapping['cascade'][] = "remove";
return $this;
}
/**
* @return AssociationBuilder
*/
public function cascadeMerge()
{
$this->mapping['cascade'][] = "merge";
return $this;
}
/**
* @return AssociationBuilder
*/
public function cascadeDetach()
{
$this->mapping['cascade'][] = "detach";
return $this;
}
/**
* @return AssociationBuilder
*/
public function cascadeRefresh()
{
$this->mapping['cascade'][] = "refresh";
return $this;
}
/**
* @return AssociationBuilder
*/
public function fetchExtraLazy()
{
$this->mapping['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
return $this;
}
/**
* @return AssociationBuilder
*/
public function fetchEager()
{
$this->mapping['fetch'] = ClassMetadata::FETCH_EAGER;
return $this;
}
/**
* @return AssociationBuilder
*/
public function fetchLazy()
{
$this->mapping['fetch'] = ClassMetadata::FETCH_LAZY;
@ -122,14 +159,16 @@ class AssociationBuilder
}
/**
* Add Join Columns
* Add Join Columns.
*
* @param string $columnName
* @param string $referencedColumnName
* @param bool $nullable
* @param bool $unique
* @param string $onDelete
* @param string $columnDef
* @param string $columnName
* @param string $referencedColumnName
* @param bool $nullable
* @param bool $unique
* @param string|null $onDelete
* @param string|null $columnDef
*
* @return AssociationBuilder
*/
public function addJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null)
{
@ -146,6 +185,8 @@ class AssociationBuilder
/**
* @return ClassMetadataBuilder
*
* @throws \InvalidArgumentException
*/
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
*/
@ -67,9 +67,10 @@ class ClassMetadataBuilder
}
/**
* Set custom Repository class name
* Sets custom Repository class name.
*
* @param string $repositoryClassName
*
* @return ClassMetadataBuilder
*/
public function setCustomRepositoryClass($repositoryClassName)
@ -80,7 +81,7 @@ class ClassMetadataBuilder
}
/**
* Mark class read only
* Marks class read only.
*
* @return ClassMetadataBuilder
*/
@ -92,9 +93,10 @@ class ClassMetadataBuilder
}
/**
* Set the table name
* Sets the table name.
*
* @param string $name
*
* @return ClassMetadataBuilder
*/
public function setTable($name)
@ -105,10 +107,11 @@ class ClassMetadataBuilder
}
/**
* Add Index
* Adds Index.
*
* @param array $columns
* @param array $columns
* @param string $name
*
* @return ClassMetadataBuilder
*/
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
*
* @return ClassMetadataBuilder
*/
public function addUniqueConstraint(array $columns, $name)
@ -141,10 +145,11 @@ class ClassMetadataBuilder
}
/**
* Add named query
* Adds named query.
*
* @param string $name
* @param string $dqlQuery
*
* @return ClassMetadataBuilder
*/
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
*/
@ -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
*/
@ -182,10 +187,13 @@ class ClassMetadataBuilder
}
/**
* Set the discriminator column details.
* Sets the discriminator column details.
*
* @param string $name
* @param string $type
* @param int $length
*
* @return ClassMetadataBuilder
*/
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 $class
*
* @return ClassMetadataBuilder
*/
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
*/
@ -225,7 +234,7 @@ class ClassMetadataBuilder
}
/**
* Set notify change tracking policy.
* Sets notify change tracking policy.
*
* @return ClassMetadataBuilder
*/
@ -237,10 +246,11 @@ class ClassMetadataBuilder
}
/**
* Add lifecycle event
* Adds lifecycle event.
*
* @param string $methodName
* @param string $event
*
* @return ClassMetadataBuilder
*/
public function addLifecycleEvent($methodName, $event)
@ -251,11 +261,13 @@ class ClassMetadataBuilder
}
/**
* Add Field
* Adds Field.
*
* @param string $name
* @param string $type
* @param array $mapping
* @param array $mapping
*
* @return ClassMetadataBuilder
*/
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 $type
*
* @return FieldBuilder
*/
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 $targetEntity
* @param string $name
* @param string $targetEntity
* @param string|null $inversedBy
*
* @return ClassMetadataBuilder
*/
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.
*
* @param string $name
* @param string $targetEntity
*
* @return AssociationBuilder
*/
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 $targetEntity
*
* @return AssociationBuilder
*/
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 $targetEntity
* @param string $mappedBy
*
* @return ClassMetadataBuilder
*/
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
*/
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 $targetEntity
*
* @return ManyToManyAssociationBuilder
*/
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 $targetEntity
* @param string $name
* @param string $targetEntity
* @param string|null $inversedBy
*
* @return ClassMetadataBuilder
*/
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 $targetEntity
* @param string $mappedBy
*
* @return ClassMetadataBuilder
*/
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 $targetEntity
*
* @return OneToManyAssociationBuilder
*/
public function createOneToMany($name, $targetEntity)
@ -453,11 +475,12 @@ class ClassMetadataBuilder
}
/**
* Add simple OneToMany assocation.
* Adds simple OneToMany assocation.
*
* @param string $name
* @param string $targetEntity
* @param string $mappedBy
*
* @return ClassMetadataBuilder
*/
public function addOneToMany($name, $targetEntity, $mappedBy)

View File

@ -33,10 +33,12 @@ class FieldBuilder
* @var ClassMetadataBuilder
*/
private $builder;
/**
* @var array
*/
private $mapping;
/**
* @var bool
*/
@ -53,9 +55,8 @@ class FieldBuilder
private $sequenceDef;
/**
*
* @param ClassMetadataBuilder $builder
* @param array $mapping
* @param array $mapping
*/
public function __construct(ClassMetadataBuilder $builder, array $mapping)
{
@ -64,9 +65,10 @@ class FieldBuilder
}
/**
* Set length.
* Sets length.
*
* @param int $length
*
* @return FieldBuilder
*/
public function length($length)
@ -76,9 +78,10 @@ class FieldBuilder
}
/**
* Set nullable
* Sets nullable.
*
* @param bool $flag
*
* @param bool
* @return FieldBuilder
*/
public function nullable($flag = true)
@ -88,9 +91,10 @@ class FieldBuilder
}
/**
* Set Unique
* Sets Unique.
*
* @param bool $flag
*
* @param bool
* @return FieldBuilder
*/
public function unique($flag = true)
@ -100,9 +104,10 @@ class FieldBuilder
}
/**
* Set column name
* Sets column name.
*
* @param string $name
*
* @return FieldBuilder
*/
public function columnName($name)
@ -112,9 +117,10 @@ class FieldBuilder
}
/**
* Set Precision
* Sets Precision.
*
* @param int $p
*
* @param int $p
* @return FieldBuilder
*/
public function precision($p)
@ -124,9 +130,10 @@ class FieldBuilder
}
/**
* Set scale.
* Sets scale.
*
* @param int $s
*
* @return FieldBuilder
*/
public function scale($s)
@ -136,7 +143,7 @@ class FieldBuilder
}
/**
* Set field as primary key.
* Sets field as primary key.
*
* @return FieldBuilder
*/
@ -147,7 +154,8 @@ class FieldBuilder
}
/**
* @param int $strategy
* @param string $strategy
*
* @return FieldBuilder
*/
public function generatedValue($strategy = 'AUTO')
@ -157,7 +165,7 @@ class FieldBuilder
}
/**
* Set field versioned
* Sets field versioned.
*
* @return FieldBuilder
*/
@ -168,11 +176,12 @@ class FieldBuilder
}
/**
* Set Sequence Generator
* Sets Sequence Generator.
*
* @param string $sequenceName
* @param int $allocationSize
* @param int $initialValue
* @param int $allocationSize
* @param int $initialValue
*
* @return FieldBuilder
*/
public function setSequenceGenerator($sequenceName, $allocationSize = 1, $initialValue = 1)
@ -186,9 +195,10 @@ class FieldBuilder
}
/**
* Set column definition.
* Sets column definition.
*
* @param string $def
*
* @return FieldBuilder
*/
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.
*

View File

@ -29,10 +29,21 @@ namespace Doctrine\ORM\Mapping\Builder;
*/
class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
{
/**
* @var string|null
*/
private $joinTableName;
/**
* @var array
*/
private $inverseJoinColumns = array();
/**
* @param string $name
*
* @return ManyToManyAssociationBuilder
*/
public function setJoinTable($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 $referencedColumnName
* @param bool $nullable
* @param bool $unique
* @param string $onDelete
* @param string $columnDef
* @param string $columnName
* @param string $referencedColumnName
* @param bool $nullable
* @param bool $unique
* @param string|null $onDelete
* @param string|null $columnDef
*
* @return ManyToManyAssociationBuilder
*/
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
*
* @return OneToManyAssociationBuilder
*/
public function setOrderBy(array $fieldNames)
@ -39,6 +40,11 @@ class OneToManyAssociationBuilder extends AssociationBuilder
return $this;
}
/**
* @param string $fieldName
*
* @return OneToManyAssociationBuilder
*/
public function setIndexBy($fieldName)
{
$this->mapping['indexBy'] = $fieldName;

View File

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

View File

@ -173,8 +173,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
/**
* Validate runtime metadata is correctly defined.
*
* @param ClassMetadata $class
* @param $parent
* @param ClassMetadata $class
* @param ClassMetadataInterface|null $parent
*
* @return void
*
* @throws MappingException
*/
protected function validateRuntimeMetadata($class, $parent)
@ -226,6 +229,7 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* each class as key.
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $class
*
* @throws MappingException
*/
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
*
* @return string
*/
private function getShortName($className)
@ -275,6 +280,8 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/
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 $parentClass
*
* @return void
*
* @throws MappingException
*/
private function addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass)
@ -324,8 +334,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* Adds inherited named queries to the subclass mapping.
*
* @since 2.2
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/
private function addInheritedNamedQueries(ClassMetadata $subClass, ClassMetadata $parentClass)
{
@ -343,8 +356,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* Adds inherited named native queries to the subclass mapping.
*
* @since 2.3
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/
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.
*
* @since 2.3
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*/
private function addInheritedSqlResultSetMappings(ClassMetadata $subClass, ClassMetadata $parentClass)
{
@ -396,6 +415,9 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
* most appropriate for the targeted database platform.
*
* @param ClassMetadataInfo $class
*
* @return void
*
* @throws ORMException
*/
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
{
/** @var string */
/**
* @var string
*/
public $name;
/** @var mixed */
/**
* @var mixed
*/
public $type = 'string';
/** @var integer */
/**
* @var integer
*/
public $length;
/** @var integer */
public $precision = 0; // The precision for a decimal (exact numeric) column (Applies only for decimal column)
/** @var integer */
public $scale = 0; // The scale for a decimal (exact numeric) column (Applies only for decimal column)
/** @var boolean */
/**
* The precision for a decimal (exact numeric) column (Applies only for decimal column).
*
* @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;
/** @var boolean */
/**
* @var boolean
*/
public $nullable = false;
/** @var array */
/**
* @var array
*/
public $options = array();
/** @var string */
/**
* @var string
*/
public $columnDefinition;
}

View File

@ -31,12 +31,10 @@ namespace Doctrine\ORM\Mapping;
*/
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
*/
public $name;
}

View File

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

View File

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

View File

@ -25,14 +25,30 @@ namespace Doctrine\ORM\Mapping;
*/
final class DiscriminatorColumn implements Annotation
{
/** @var string */
/**
* @var string
*/
public $name;
/** @var string */
/**
* @var string
*/
public $type;
/** @var integer */
/**
* @var integer
*/
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;
}

View File

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

View File

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

View File

@ -19,18 +19,17 @@
namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\DBAL\Schema\AbstractSchemaManager,
Doctrine\DBAL\Schema\SchemaException,
Doctrine\Common\Persistence\Mapping\Driver\MappingDriver,
Doctrine\Common\Persistence\Mapping\ClassMetadata,
Doctrine\ORM\Mapping\ClassMetadataInfo,
Doctrine\Common\Util\Inflector,
Doctrine\ORM\Mapping\MappingException;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\Common\Util\Inflector;
use Doctrine\ORM\Mapping\MappingException;
/**
* The DatabaseDriver reverse engineers the mapping metadata from a database.
*
*
* @link www.doctrine-project.org
* @since 2.0
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
@ -45,10 +44,13 @@ class DatabaseDriver implements MappingDriver
private $_sm;
/**
* @var array
* @var array|null
*/
private $tables = null;
/**
* @var array
*/
private $classToTableNames = array();
/**
@ -69,12 +71,11 @@ class DatabaseDriver implements MappingDriver
/**
* The namespace for the generated entities.
*
* @var string
* @var string|null
*/
private $namespace;
/**
*
* @param 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 $manyToManyTables
*
* @return void
*/
public function setTables($entityTables, $manyToManyTables)
@ -102,6 +104,11 @@ class DatabaseDriver implements MappingDriver
}
}
/**
* @return void
*
* @throws \Doctrine\ORM\Mapping\MappingException
*/
private function reverseEngineerMappingFromDatabase()
{
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 $className
*
* @return void
*/
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 $columnName
* @param string $fieldName
*
* @return void
*/
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
*
* @return string
*/
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.
*
* @param string $tableName
* @param string $columnName
* @param string $tableName
* @param string $columnName
* @param boolean $fk Whether the column is a foreignkey or not.
*
* @return string
*/
private function getFieldNameForColumn($tableName, $columnName, $fk = false)
@ -406,6 +417,7 @@ class DatabaseDriver implements MappingDriver
* Set the namespace for the generated entities.
*
* @param string $namespace
*
* @return void
*/
public function setNamespace($namespace)

View File

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

View File

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

View File

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

View File

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

View File

@ -19,10 +19,10 @@
namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Common\Persistence\Mapping\ClassMetadata,
Doctrine\Common\Persistence\Mapping\Driver\FileDriver,
Doctrine\ORM\Mapping\MappingException,
Symfony\Component\Yaml\Yaml;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\Mapping\Driver\FileDriver;
use Doctrine\ORM\Mapping\MappingException;
use Symfony\Component\Yaml\Yaml;
/**
* 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
* 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.
*/
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
*/
private function columnToArray($fieldName, $column)

View File

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

View File

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

View File

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

View File

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

View File

@ -26,7 +26,9 @@ namespace Doctrine\ORM\Mapping;
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"})
*/

View File

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

View File

@ -26,7 +26,9 @@ namespace Doctrine\ORM\Mapping;
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"})
*/

View File

@ -25,18 +25,40 @@ namespace Doctrine\ORM\Mapping;
*/
final class JoinColumn implements Annotation
{
/** @var string */
/**
* @var string
*/
public $name;
/** @var string */
/**
* @var string
*/
public $referencedColumnName = 'id';
/** @var boolean */
/**
* @var boolean
*/
public $unique = false;
/** @var boolean */
/**
* @var boolean
*/
public $nullable = true;
/** @var mixed */
/**
* @var mixed
*/
public $onDelete;
/** @var string */
/**
* @var string
*/
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
{
/** @var array<\Doctrine\ORM\Mapping\JoinColumn> */
/**
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
*/
public $value;
}

View File

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

View File

@ -46,7 +46,9 @@ final class ManyToMany implements Annotation
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"})
*/

View File

@ -36,7 +36,9 @@ final class ManyToOne implements Annotation
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"})
*/

View File

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

View File

@ -26,12 +26,20 @@ namespace Doctrine\ORM\Mapping;
*/
class MappingException extends \Doctrine\ORM\ORMException
{
/**
* @return MappingException
*/
public static function pathRequired()
{
return new self("Specifying the paths to your entities is required ".
"in the AnnotationDriver to retrieve all class names.");
}
/**
* @param string $entityName
*
* @return MappingException
*/
public static function identifierRequired($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)
{
return new self("The inheritance type '$type' specified for '$entityName' does not exist.");
}
/**
* @return MappingException
*/
public static function generatorNotAllowedWithCompositeId()
{
return new self("Id generators can't be used with a composite id.");
}
/**
* @param string $entity
*
* @return MappingException
*/
public static function missingFieldName($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)
{
return new self("The association mapping '$fieldName' misses the 'targetEntity' attribute.");
}
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function missingSourceEntity($fieldName)
{
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)
{
return new self("No mapping file found named '$fileName' for class '$entityName'.");
}
/**
/**
* Exception for invalid property name override.
*
* @param string $className The entity's name
* @param string $className The entity's name.
* @param string $fieldName
*
* @return MappingException
*/
public static function invalidOverrideFieldName($className, $fieldName)
{
@ -92,64 +132,128 @@ class MappingException extends \Doctrine\ORM\ORMException
/**
* Exception for invalid property type override.
*
* @param string $className The entity's name
* @param string $className The entity's name.
* @param string $fieldName
*
* @return MappingException
*/
public static function invalidOverrideFieldType($className, $fieldName)
{
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)
{
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)
{
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)
{
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)
{
return new self('Query named "'.$queryName.'" in "'.$entity.'" could not be empty.');
}
/**
* @param string $className
*
* @return MappingException
*/
public static function nameIsMandatoryForQueryMapping($className)
{
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)
{
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)
{
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)
{
return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a field name.');
}
/**
* @param string $className
*
* @return MappingException
*/
public static function nameIsMandatoryForSqlResultSetMapping($className)
{
return new self("Result set mapping name on entity class '$className' is not defined.");
}
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function oneToManyRequiresMappedBy($fieldName)
{
return new self("OneToMany mapping on field '$fieldName' requires the 'mappedBy' attribute.");
}
/**
* @param string $fieldName
*
* @return MappingException
*/
public static function joinTableRequired($fieldName)
{
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
*
* @param string $field which field cannot be processed?
* @param string $expectedOption which option is required
* @param string $hint Can optionally be used to supply a tip for common mistakes,
* e.g. "Did you think of the plural s?"
* @param string $field Which field cannot be processed?
* @param string $expectedOption Which option is required
* @param string $hint Can optionally be used to supply a tip for common mistakes,
* e.g. "Did you think of the plural s?"
*
* @return MappingException
*/
static function missingRequiredOption($field, $expectedOption, $hint = '')
@ -179,6 +284,8 @@ class MappingException extends \Doctrine\ORM\ORMException
* Generic exception for invalid mappings.
*
* @param string $fieldName
*
* @return MappingException
*/
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
* within the stacktrace
*
* @param string $entity The entity's name
* @param string $entity The entity's name
* @param \ReflectionException $previousException
*
* @return MappingException
*/
public static function reflectionFailure($entity, \ReflectionException $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)
{
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.');
}
/**
* @param string $className
*
* @return MappingException
*/
public static function classIsNotAValidEntityOrMappedSuperClass($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)
{
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)
{
return new self("TableIdGenerator is not yet implemented for use with class ".$className);
}
/**
* @param string $entity The entity's name
* @param string $fieldName The name of the field that was already declared
* @param string $entity The entity's name.
* @param string $fieldName The name of the field that was already declared.
*
* @return MappingException
*/
public static function duplicateFieldMapping($entity, $fieldName)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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.
*
* @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.
* @return self
*
* @return MappingException
*/
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)
{
return new self(
@ -304,46 +480,87 @@ class MappingException extends \Doctrine\ORM\ORMException
);
}
/**
* @param string $className
*
* @return MappingException
*/
public static function missingDiscriminatorMap($className)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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 $columnName
* @return self
* @param string $className
* @param string $columnName
*
* @return MappingException
*/
public static function duplicateColumnName($className, $columnName)
{
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)
{
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 $targetEntity
* @param string $targetField
* @return self
*
* @return MappingException
*/
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."'.");
}
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function noSingleAssociationJoinColumnFound($className, $field)
{
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)
{
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.");
}
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalOrphanRemovalOnIdentifierAssociation($className, $field)
{
return new self("The orphan removal option is not allowed on an association that is ".
"part of the identifier in '$className#$field'.");
}
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalOrphanRemoval($className, $field)
{
return new self("Orphan removal is only allowed on one-to-one and one-to-many ".
"associations, but " . $className."#" .$field . " is not.");
}
/**
* @param string $className
* @param string $field
*
* @return MappingException
*/
public static function illegalInverseIdentifierAssocation($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)
{
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)
{
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)
{
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)
{
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)
{
return new self("Entity '" . $className . "' has a mapping with invalid fetch mode '" . $annotation . "'");
}
/**
* @param string $className
*
* @return MappingException
*/
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.");
}
/**
* @param string $targetEntity
* @param string $sourceEntity
* @param string $associationName
*
* @return MappingException
*/
public static function invalidTargetEntityClass($targetEntity, $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)
{
$cascades = implode(", ", array_map(function ($e) { return "'" . $e . "'"; }, $cascades));

View File

@ -31,7 +31,6 @@ namespace Doctrine\ORM\Mapping;
*/
final class NamedNativeQuery implements Annotation
{
/**
* 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
*/
public $resultSetMapping;
}

View File

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

View File

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

View File

@ -31,53 +31,58 @@ namespace Doctrine\ORM\Mapping;
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
* @return string A table name
* @param string $className The fully-qualified class name.
*
* @return string A table name.
*/
function classToTableName($className);
/**
* Return a column name for a property
* Returns a column name for a property.
*
* @param string $propertyName A property
* @param string $className The fully-qualified class name
* @return string A column name
* @param string $propertyName A property name.
* @param string|null $className The fully-qualified class name.
*
* @return string A column name.
*/
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();
/**
* Return a join column name for a property
* Returns a join column name for a property.
*
* @param string $propertyName A property
* @return string A join column name
* @param string $propertyName A property name.
*
* @return string A join column name.
*/
function joinColumnName($propertyName);
/**
* Return a join table name
* Returns a join table name.
*
* @param string $sourceEntity The source entity
* @param string $targetEntity The target entity
* @param string $propertyName A property
* @return string A join table name
* @param string $sourceEntity The source entity.
* @param string $targetEntity The target entity.
* @param string|null $propertyName A property name.
*
* @return string A join table name.
*/
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 $referencedColumnName A property
* @return string A join column name
* @param string $entityName An entity.
* @param string|null $referencedColumnName A property.
*
* @return string A join column name.
*/
function joinKeyColumnName($entityName, $referencedColumnName = null);
}

View File

@ -41,7 +41,9 @@ final class OneToMany implements Annotation
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"})
*/

View File

@ -46,7 +46,9 @@ final class OneToOne implements Annotation
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"})
*/

View File

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

View File

@ -23,7 +23,7 @@ use Doctrine\ORM\Mapping\ClassMetadata;
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
* @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.
*
* @param string $fieldName
* @param ClassMetadata $class
* @param AbstractPlatform $platform
* @return string
* @param string $fieldName
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return string
*/
function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform);
/**
* Gets the (possibly quoted) primary table name for safe use in an SQL statement.
*
* @param ClassMetadata $class
* @param AbstractPlatform $platform
* @return string
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return string
*/
function getTableName(ClassMetadata $class, AbstractPlatform $platform);
/**
* Gets the (possibly quoted) sequence name for safe use in an SQL statement.
*
* @param array $definition
* @param ClassMetadata $class
* @param AbstractPlatform $platform
* @return string
* @param array $definition
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return string
*/
function getSequenceName(array $definition, ClassMetadata $class, AbstractPlatform $platform);
/**
* Gets the (possibly quoted) name of the join table.
*
* @param array $association
* @param ClassMetadata $class
* @param AbstractPlatform $platform
* @return string
* @param array $association
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return string
*/
function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform);
/**
* Gets the (possibly quoted) join column name.
*
* @param array $joinColumn
* @param ClassMetadata $class
* @param AbstractPlatform $platform
* @return string
* @param array $joinColumn
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return string
*/
function getJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
/**
* Gets the (possibly quoted) join column name.
*
* @param array $joinColumn
* @param ClassMetadata $class
* @param AbstractPlatform $platform
* @return string
* @param array $joinColumn
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return string
*/
function getReferencedJoinColumnName(array $joinColumn, ClassMetadata $class, AbstractPlatform $platform);
/**
* Gets the (possibly quoted) identifier column names for safe use in an SQL statement.
*
* @param ClassMetadata $class
* @param AbstractPlatform $platform
* @return array
* @param ClassMetadata $class
* @param AbstractPlatform $platform
*
* @return array
*/
function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform);
/**
* Gets the column alias.
*
* @param string $columnName
* @param integer $counter
* @param AbstractPlatform $platform
* @param ClassMetadata $class
* @return string
* @param string $columnName
* @param integer $counter
* @param AbstractPlatform $platform
* @param ClassMetadata|null $class
*
* @return string
*/
function getColumnAlias($columnName, $counter, AbstractPlatform $platform, ClassMetadata $class = null);
}
}

View File

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

View File

@ -31,7 +31,6 @@ namespace Doctrine\ORM\Mapping;
*/
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.
*
@ -52,5 +51,4 @@ final class SqlResultSetMapping implements Annotation
* @var array<\Doctrine\ORM\Mapping\ColumnResult>
*/
public $columns = array();
}

View File

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

View File

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

View File

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