本文整理汇总了PHP中Doctrine\ORM\Mapping\ClassMetadataInfo::setCustomGeneratorDefinition方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassMetadataInfo::setCustomGeneratorDefinition方法的具体用法?PHP ClassMetadataInfo::setCustomGeneratorDefinition怎么用?PHP ClassMetadataInfo::setCustomGeneratorDefinition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Mapping\ClassMetadataInfo
的用法示例。
在下文中一共展示了ClassMetadataInfo::setCustomGeneratorDefinition方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadMetadata
public static function loadMetadata(ClassMetadataInfo $metadata)
{
$metadata->mapField(array('id' => true, 'fieldName' => 'id', 'type' => 'string'));
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_CUSTOM);
$metadata->setCustomGeneratorDefinition(array('class' => 'Doctrine\\Tests\\ORM\\Functional\\Ticket\\DDC2415Generator'));
$metadata->isMappedSuperclass = true;
}
示例2: build
/**
* Execute the build process
*/
public function build()
{
$this->builder->generatedValue($this->strategy);
if ($this->name) {
$this->builder->setSequenceGenerator($this->name, $this->size, $this->initial);
}
if ($this->generator) {
$this->classMetadata->setCustomGeneratorDefinition(['class' => $this->generator]);
}
}
示例3: evaluatePropertyAnnotations
//.........这里部分代码省略.........
if ($orderByAnnotation = $this->reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\OrderBy')) {
$mapping['orderBy'] = $orderByAnnotation->value;
}
$metadata->mapOneToMany($mapping);
} elseif ($manyToOneAnnotation = $this->reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\ManyToOne')) {
if ($manyToOneAnnotation->targetEntity) {
$mapping['targetEntity'] = $manyToOneAnnotation->targetEntity;
}
$mapping['joinColumns'] = $this->buildJoinColumnsIfNeeded($joinColumns, $mapping, $property);
if ($manyToOneAnnotation->cascade) {
$mapping['cascade'] = $manyToOneAnnotation->cascade;
} elseif ($this->isValueObject($mapping['targetEntity'], $className)) {
$mapping['cascade'] = array('persist');
} elseif ($this->isAggregateRoot($mapping['targetEntity'], $className) === false) {
$mapping['cascade'] = array('all');
}
$mapping['inversedBy'] = $manyToOneAnnotation->inversedBy;
$mapping['fetch'] = $this->getFetchMode($className, $manyToOneAnnotation->fetch);
$metadata->mapManyToOne($mapping);
} elseif ($manyToManyAnnotation = $this->reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\ManyToMany')) {
if ($manyToManyAnnotation->targetEntity) {
$mapping['targetEntity'] = $manyToManyAnnotation->targetEntity;
} elseif (isset($propertyMetaData['elementType'])) {
$mapping['targetEntity'] = $propertyMetaData['elementType'];
}
/** @var JoinTable $joinTableAnnotation */
if ($joinTableAnnotation = $this->reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\JoinTable')) {
$joinTable = $this->evaluateJoinTableAnnotation($joinTableAnnotation, $property, $className, $mapping);
} else {
$joinColumns = array(array('name' => null, 'referencedColumnName' => null));
$joinTable = array('name' => $this->inferJoinTableNameFromClassAndPropertyName($className, $property->getName()), 'joinColumns' => $this->buildJoinColumnsIfNeeded($joinColumns, $mapping, $property, self::MAPPING_MM_REGULAR), 'inverseJoinColumns' => $this->buildJoinColumnsIfNeeded($joinColumns, $mapping, $property));
}
$mapping['joinTable'] = $joinTable;
$mapping['mappedBy'] = $manyToManyAnnotation->mappedBy;
$mapping['inversedBy'] = $manyToManyAnnotation->inversedBy;
if ($manyToManyAnnotation->cascade) {
$mapping['cascade'] = $manyToManyAnnotation->cascade;
} elseif ($this->isValueObject($mapping['targetEntity'], $className)) {
$mapping['cascade'] = array('persist');
} elseif ($this->isAggregateRoot($mapping['targetEntity'], $className) === false) {
$mapping['cascade'] = array('all');
}
$mapping['indexBy'] = $manyToManyAnnotation->indexBy;
$mapping['orphanRemoval'] = $manyToManyAnnotation->orphanRemoval;
$mapping['fetch'] = $this->getFetchMode($className, $manyToManyAnnotation->fetch);
if ($orderByAnnotation = $this->reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\OrderBy')) {
$mapping['orderBy'] = $orderByAnnotation->value;
}
$metadata->mapManyToMany($mapping);
} else {
$mapping['nullable'] = false;
/** @var Column $columnAnnotation */
if ($columnAnnotation = $this->reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\Column')) {
$mapping = $this->addColumnToMappingArray($columnAnnotation, $mapping);
}
if (!isset($mapping['type'])) {
switch ($propertyMetaData['type']) {
case 'DateTime':
$mapping['type'] = 'datetime';
break;
case 'string':
case 'integer':
case 'boolean':
case 'float':
case 'array':
$mapping['type'] = $propertyMetaData['type'];
break;
default:
if (strpos($propertyMetaData['type'], '\\') !== false) {
if ($this->reflectionService->isClassAnnotatedWith($propertyMetaData['type'], \TYPO3\Flow\Annotations\ValueObject::class)) {
$mapping['type'] = 'object';
} elseif (class_exists($propertyMetaData['type'])) {
throw MappingException::missingRequiredOption($property->getName(), 'OneToOne', sprintf('The property "%s" in class "%s" has a non standard data type and doesn\'t define the type of the relation. You have to use one of these annotations: @OneToOne, @OneToMany, @ManyToOne, @ManyToMany', $property->getName(), $className));
}
} else {
throw MappingException::propertyTypeIsRequired($className, $property->getName());
}
}
}
if ($this->reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\Id') !== null) {
$mapping['id'] = true;
}
if ($generatedValueAnnotation = $this->reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\GeneratedValue')) {
$metadata->setIdGeneratorType(constant('Doctrine\\ORM\\Mapping\\ClassMetadata::GENERATOR_TYPE_' . strtoupper($generatedValueAnnotation->strategy)));
}
if ($this->reflectionService->isPropertyAnnotatedWith($className, $property->getName(), 'Doctrine\\ORM\\Mapping\\Version')) {
$metadata->setVersionMapping($mapping);
}
$metadata->mapField($mapping);
// Check for SequenceGenerator/TableGenerator definition
if ($seqGeneratorAnnotation = $this->reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\SequenceGenerator')) {
$metadata->setSequenceGeneratorDefinition(array('sequenceName' => $seqGeneratorAnnotation->sequenceName, 'allocationSize' => $seqGeneratorAnnotation->allocationSize, 'initialValue' => $seqGeneratorAnnotation->initialValue));
} elseif ($this->reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\TableGenerator') !== null) {
throw MappingException::tableIdGeneratorNotImplemented($className);
} elseif ($customGeneratorAnnotation = $this->reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\CustomIdGenerator')) {
$metadata->setCustomGeneratorDefinition(array('class' => $customGeneratorAnnotation->class));
}
}
}
}
示例4: loadMetadata
public static function loadMetadata(ClassMetadataInfo $metadata)
{
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_CUSTOM);
$metadata->setCustomGeneratorDefinition(array("class" => "stdClass"));
}
示例5: loadMetadataForClass
//.........这里部分代码省略.........
$metadata->table['options'] = $element['options'];
}
$associationIds = array();
if (isset($element['id'])) {
// Evaluate identifier settings
foreach ($element['id'] as $name => $idElement) {
if (isset($idElement['associationKey']) && $idElement['associationKey'] == true) {
$associationIds[$name] = true;
continue;
}
$mapping = array('id' => true, 'fieldName' => $name);
if (isset($idElement['type'])) {
$mapping['type'] = $idElement['type'];
}
if (isset($idElement['column'])) {
$mapping['columnName'] = $idElement['column'];
}
if (isset($idElement['length'])) {
$mapping['length'] = $idElement['length'];
}
if (isset($idElement['columnDefinition'])) {
$mapping['columnDefinition'] = $idElement['columnDefinition'];
}
$metadata->mapField($mapping);
if (isset($idElement['generator'])) {
$metadata->setIdGeneratorType(constant('Doctrine\\ORM\\Mapping\\ClassMetadata::GENERATOR_TYPE_' . strtoupper($idElement['generator']['strategy'])));
}
// Check for SequenceGenerator/TableGenerator definition
if (isset($idElement['sequenceGenerator'])) {
$metadata->setSequenceGeneratorDefinition($idElement['sequenceGenerator']);
} else {
if (isset($idElement['customIdGenerator'])) {
$customGenerator = $idElement['customIdGenerator'];
$metadata->setCustomGeneratorDefinition(array('class' => (string) $customGenerator['class']));
} else {
if (isset($idElement['tableGenerator'])) {
throw MappingException::tableIdGeneratorNotImplemented($className);
}
}
}
}
}
// Evaluate fields
if (isset($element['fields'])) {
foreach ($element['fields'] as $name => $fieldMapping) {
$mapping = array('fieldName' => $name);
if (isset($fieldMapping['type'])) {
$e = explode('(', $fieldMapping['type']);
$fieldMapping['type'] = $e[0];
$mapping['type'] = $fieldMapping['type'];
if (isset($e[1])) {
$fieldMapping['length'] = substr($e[1], 0, strlen($e[1]) - 1);
}
}
if (isset($fieldMapping['id'])) {
$mapping['id'] = true;
if (isset($fieldMapping['generator']['strategy'])) {
$metadata->setIdGeneratorType(constant('Doctrine\\ORM\\Mapping\\ClassMetadata::GENERATOR_TYPE_' . strtoupper($fieldMapping['generator']['strategy'])));
}
}
if (isset($fieldMapping['column'])) {
$mapping['columnName'] = $fieldMapping['column'];
}
if (isset($fieldMapping['length'])) {
$mapping['length'] = $fieldMapping['length'];
}
示例6: evaluatePropertyAnnotations
//.........这里部分代码省略.........
$mapping['targetEntity'] = $manyToManyAnnotation->targetEntity;
} elseif (isset($propertyMetaData['elementType'])) {
$mapping['targetEntity'] = $propertyMetaData['elementType'];
}
/** @var ORM\JoinTable $joinTableAnnotation */
if ($joinTableAnnotation = $this->reader->getPropertyAnnotation($property, ORM\JoinTable::class)) {
$joinTable = $this->evaluateJoinTableAnnotation($joinTableAnnotation, $property, $className, $mapping);
} else {
$joinColumns = [['name' => null, 'referencedColumnName' => null]];
$joinTable = ['name' => $this->inferJoinTableNameFromClassAndPropertyName($className, $property->getName()), 'joinColumns' => $this->buildJoinColumnsIfNeeded($joinColumns, $mapping, $property, self::MAPPING_MM_REGULAR), 'inverseJoinColumns' => $this->buildJoinColumnsIfNeeded($joinColumns, $mapping, $property)];
}
$mapping['joinTable'] = $joinTable;
$mapping['mappedBy'] = $manyToManyAnnotation->mappedBy;
$mapping['inversedBy'] = $manyToManyAnnotation->inversedBy;
if ($manyToManyAnnotation->cascade) {
$mapping['cascade'] = $manyToManyAnnotation->cascade;
} elseif ($this->isValueObject($mapping['targetEntity'], $className)) {
$mapping['cascade'] = ['persist'];
} elseif ($this->isAggregateRoot($mapping['targetEntity'], $className) === false) {
$mapping['cascade'] = ['all'];
}
$mapping['indexBy'] = $manyToManyAnnotation->indexBy;
$mapping['orphanRemoval'] = $manyToManyAnnotation->orphanRemoval;
$mapping['fetch'] = $this->getFetchMode($className, $manyToManyAnnotation->fetch);
if ($orderByAnnotation = $this->reader->getPropertyAnnotation($property, ORM\OrderBy::class)) {
$mapping['orderBy'] = $orderByAnnotation->value;
}
$metadata->mapManyToMany($mapping);
} elseif ($embeddedAnnotation = $this->reader->getPropertyAnnotation($property, ORM\Embedded::class)) {
if ($embeddedAnnotation->class) {
$mapping['class'] = $embeddedAnnotation->class;
} else {
// This will not happen currently, because "class" argument is required. It would be nice if that could be changed though.
$mapping['class'] = $mapping['targetEntity'];
}
$mapping['columnPrefix'] = $embeddedAnnotation->columnPrefix;
$metadata->mapEmbedded($mapping);
} else {
$mapping['nullable'] = false;
/** @var ORM\Column $columnAnnotation */
if ($columnAnnotation = $this->reader->getPropertyAnnotation($property, ORM\Column::class)) {
$mapping = $this->addColumnToMappingArray($columnAnnotation, $mapping);
}
if (!isset($mapping['type'])) {
switch ($propertyMetaData['type']) {
case 'DateTime':
$mapping['type'] = 'datetime';
break;
case 'string':
case 'integer':
case 'boolean':
case 'float':
case 'array':
$mapping['type'] = $propertyMetaData['type'];
break;
default:
if (strpos($propertyMetaData['type'], '\\') !== false) {
if ($this->reflectionService->isClassAnnotatedWith($propertyMetaData['type'], Flow\ValueObject::class)) {
$valueObjectAnnotation = $this->reflectionService->getClassAnnotation($propertyMetaData['type'], Flow\ValueObject::class);
if ($valueObjectAnnotation->embedded === true) {
$mapping['class'] = $propertyMetaData['type'];
$mapping['columnPrefix'] = $mapping['columnName'];
$metadata->mapEmbedded($mapping);
// Leave switch and continue with next property
continue 2;
}
$mapping['type'] = 'object';
} elseif (class_exists($propertyMetaData['type'])) {
throw ORM\MappingException::missingRequiredOption($property->getName(), 'OneToOne', sprintf('The property "%s" in class "%s" has a non standard data type and doesn\'t define the type of the relation. You have to use one of these annotations: @OneToOne, @OneToMany, @ManyToOne, @ManyToMany', $property->getName(), $className));
}
} else {
throw ORM\MappingException::propertyTypeIsRequired($className, $property->getName());
}
}
}
if ($this->reader->getPropertyAnnotation($property, ORM\Id::class) !== null) {
$mapping['id'] = true;
}
if ($generatedValueAnnotation = $this->reader->getPropertyAnnotation($property, ORM\GeneratedValue::class)) {
$metadata->setIdGeneratorType(constant('Doctrine\\ORM\\Mapping\\ClassMetadata::GENERATOR_TYPE_' . strtoupper($generatedValueAnnotation->strategy)));
}
if ($this->reflectionService->isPropertyAnnotatedWith($className, $property->getName(), ORM\Version::class)) {
$metadata->setVersionMapping($mapping);
}
$metadata->mapField($mapping);
// Check for SequenceGenerator/TableGenerator definition
if ($seqGeneratorAnnotation = $this->reader->getPropertyAnnotation($property, ORM\SequenceGenerator::class)) {
$metadata->setSequenceGeneratorDefinition(['sequenceName' => $seqGeneratorAnnotation->sequenceName, 'allocationSize' => $seqGeneratorAnnotation->allocationSize, 'initialValue' => $seqGeneratorAnnotation->initialValue]);
} elseif ($this->reader->getPropertyAnnotation($property, ORM\TableGenerator::class) !== null) {
throw ORM\MappingException::tableIdGeneratorNotImplemented($className);
} elseif ($customGeneratorAnnotation = $this->reader->getPropertyAnnotation($property, ORM\CustomIdGenerator::class)) {
$metadata->setCustomGeneratorDefinition(['class' => $customGeneratorAnnotation->class]);
}
}
// Evaluate @Cache annotation
if (($cacheAnnotation = $this->reader->getPropertyAnnotation($property, ORM\Cache::class)) !== null) {
$metadata->enableAssociationCache($mapping['fieldName'], array('usage' => constant('Doctrine\\ORM\\Mapping\\ClassMetadata::CACHE_USAGE_' . $cacheAnnotation->usage), 'region' => $cacheAnnotation->region));
}
}
}
示例7: loadMetadataForClass
//.........这里部分代码省略.........
}
$metadata->mapField($mapping);
}
}
// Evaluate <id ...> mappings
$associationIds = array();
foreach ($xmlRoot->id as $idElement) {
if ((bool) $idElement['association-key'] == true) {
$associationIds[(string) $idElement['name']] = true;
continue;
}
$mapping = array('id' => true, 'fieldName' => (string) $idElement['name']);
if (isset($idElement['type'])) {
$mapping['type'] = (string) $idElement['type'];
}
if (isset($idElement['column'])) {
$mapping['columnName'] = (string) $idElement['column'];
}
if (isset($idElement['column-definition'])) {
$mapping['columnDefinition'] = (string) $idElement['column-definition'];
}
$metadata->mapField($mapping);
if (isset($idElement->generator)) {
$strategy = isset($idElement->generator['strategy']) ? (string) $idElement->generator['strategy'] : 'AUTO';
$metadata->setIdGeneratorType(constant('Doctrine\\ORM\\Mapping\\ClassMetadata::GENERATOR_TYPE_' . $strategy));
}
// Check for SequenceGenerator/TableGenerator definition
if (isset($idElement->{'sequence-generator'})) {
$seqGenerator = $idElement->{'sequence-generator'};
$metadata->setSequenceGeneratorDefinition(array('sequenceName' => (string) $seqGenerator['sequence-name'], 'allocationSize' => (string) $seqGenerator['allocation-size'], 'initialValue' => (string) $seqGenerator['initial-value']));
} else {
if (isset($idElement->{'custom-id-generator'})) {
$customGenerator = $idElement->{'custom-id-generator'};
$metadata->setCustomGeneratorDefinition(array('class' => (string) $customGenerator['class']));
} else {
if (isset($idElement->{'table-generator'})) {
throw MappingException::tableIdGeneratorNotImplemented($className);
}
}
}
}
// Evaluate <one-to-one ...> mappings
if (isset($xmlRoot->{'one-to-one'})) {
foreach ($xmlRoot->{'one-to-one'} as $oneToOneElement) {
$mapping = array('fieldName' => (string) $oneToOneElement['field'], 'targetEntity' => (string) $oneToOneElement['target-entity']);
if (isset($associationIds[$mapping['fieldName']])) {
$mapping['id'] = true;
}
if (isset($oneToOneElement['fetch'])) {
$mapping['fetch'] = constant('Doctrine\\ORM\\Mapping\\ClassMetadata::FETCH_' . (string) $oneToOneElement['fetch']);
}
if (isset($oneToOneElement['mapped-by'])) {
$mapping['mappedBy'] = (string) $oneToOneElement['mapped-by'];
} else {
if (isset($oneToOneElement['inversed-by'])) {
$mapping['inversedBy'] = (string) $oneToOneElement['inversed-by'];
}
$joinColumns = array();
if (isset($oneToOneElement->{'join-column'})) {
$joinColumns[] = $this->_getJoinColumnMapping($oneToOneElement->{'join-column'});
} else {
if (isset($oneToOneElement->{'join-columns'})) {
foreach ($oneToOneElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
$joinColumns[] = $this->_getJoinColumnMapping($joinColumnElement);
}
}
示例8: loadMetadataForClass
//.........这里部分代码省略.........
$mapping['type'] = $columnAnnot->type;
$mapping['length'] = $columnAnnot->length;
$mapping['precision'] = $columnAnnot->precision;
$mapping['scale'] = $columnAnnot->scale;
$mapping['nullable'] = $columnAnnot->nullable;
$mapping['unique'] = $columnAnnot->unique;
if ($columnAnnot->options) {
$mapping['options'] = $columnAnnot->options;
}
if (isset($columnAnnot->name)) {
$mapping['columnName'] = $columnAnnot->name;
}
if (isset($columnAnnot->columnDefinition)) {
$mapping['columnDefinition'] = $columnAnnot->columnDefinition;
}
if ($idAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\Id')) {
$mapping['id'] = true;
}
if ($generatedValueAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\GeneratedValue')) {
$metadata->setIdGeneratorType(constant('Doctrine\\ORM\\Mapping\\ClassMetadata::GENERATOR_TYPE_' . $generatedValueAnnot->strategy));
}
if ($this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\Version')) {
$metadata->setVersionMapping($mapping);
}
$metadata->mapField($mapping);
// Check for SequenceGenerator/TableGenerator definition
if ($seqGeneratorAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\SequenceGenerator')) {
$metadata->setSequenceGeneratorDefinition(array('sequenceName' => $seqGeneratorAnnot->sequenceName, 'allocationSize' => $seqGeneratorAnnot->allocationSize, 'initialValue' => $seqGeneratorAnnot->initialValue));
} else {
if ($this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\TableGenerator')) {
throw MappingException::tableIdGeneratorNotImplemented($className);
} else {
if ($customGeneratorAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\CustomIdGenerator')) {
$metadata->setCustomGeneratorDefinition(array('class' => $customGeneratorAnnot->class));
}
}
}
} else {
if ($oneToOneAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\OneToOne')) {
if ($idAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\Id')) {
$mapping['id'] = true;
}
$mapping['targetEntity'] = $oneToOneAnnot->targetEntity;
$mapping['joinColumns'] = $joinColumns;
$mapping['mappedBy'] = $oneToOneAnnot->mappedBy;
$mapping['inversedBy'] = $oneToOneAnnot->inversedBy;
$mapping['cascade'] = $oneToOneAnnot->cascade;
$mapping['orphanRemoval'] = $oneToOneAnnot->orphanRemoval;
$mapping['fetch'] = $this->getFetchMode($className, $oneToOneAnnot->fetch);
$metadata->mapOneToOne($mapping);
} else {
if ($oneToManyAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\OneToMany')) {
$mapping['mappedBy'] = $oneToManyAnnot->mappedBy;
$mapping['targetEntity'] = $oneToManyAnnot->targetEntity;
$mapping['cascade'] = $oneToManyAnnot->cascade;
$mapping['indexBy'] = $oneToManyAnnot->indexBy;
$mapping['orphanRemoval'] = $oneToManyAnnot->orphanRemoval;
$mapping['fetch'] = $this->getFetchMode($className, $oneToManyAnnot->fetch);
if ($orderByAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\OrderBy')) {
$mapping['orderBy'] = $orderByAnnot->value;
}
$metadata->mapOneToMany($mapping);
} else {
if ($manyToOneAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\ManyToOne')) {
if ($idAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\Id')) {
$mapping['id'] = true;