本文整理汇总了PHP中Doctrine\ORM\Mapping\ClassMetadataInfo::mapManyToMany方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassMetadataInfo::mapManyToMany方法的具体用法?PHP ClassMetadataInfo::mapManyToMany怎么用?PHP ClassMetadataInfo::mapManyToMany使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Mapping\ClassMetadataInfo
的用法示例。
在下文中一共展示了ClassMetadataInfo::mapManyToMany方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testManyToManyHasPrefix
public function testManyToManyHasPrefix()
{
$this->metadata->mapManyToMany(['fieldName' => 'fooBar', 'targetEntity' => 'bar']);
$tablePrefix = new TablePrefixListener('someprefix_');
$tablePrefix->loadClassMetadata($this->args);
$this->assertEquals('someprefix_foo', $this->metadata->getTableName());
$this->assertEquals('someprefix_foo_bar', $this->metadata->associationMappings['fooBar']['joinTable']['name']);
}
示例2: setUpBeforeClass
static public function setUpBeforeClass()
{
$metadata = new ClassMetadataInfo('Propel\\Tests\\Builder\\ORM\\Book');
$metadata->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$metadata->mapField(array('fieldName' => 'name', 'type' => 'string', 'columnName' => 'foo_name', 'length' => 25, 'nullable' => true, 'columnDefinition' => 'Hello world'));
$metadata->mapField(array('fieldName' => 'status', 'type' => 'integer', 'default' => 23, 'precision' => 2, 'scale' => 2, 'unique' => 'unique_status'));
$metadata->mapOneToOne(array(
'fieldName' => 'author',
'targetEntity' => 'Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor',
'mappedBy' => 'book',
'joinColumns' => array(
array('name' => 'author_id', 'referencedColumnName' => 'id')
),
));
$metadata->mapManyToMany(array(
'fieldName' => 'comments',
'targetEntity' => 'Doctrine\Tests\ORM\Tools\EntityGeneratorComment',
'joinTable' => array(
'name' => 'book_comment',
'joinColumns' => array(array('name' => 'book_id', 'referencedColumnName' => 'id')),
'inverseJoinColumns' => array(array('name' => 'comment_id', 'referencedColumnName' => 'id')),
),
));
$builder = new BaseActiveRecord($metadata);
eval('?>' . $builder->getCode());
}
示例3: ClassMetadataInfo
function it_configures_the_mappings_of_an_original_model_that_is_override($configuration)
{
$metadataInfo = new ClassMetadataInfo('Foo\\Bar\\OriginalQux');
$metadataInfo->mapManyToMany(['fieldName' => 'relation1', 'targetEntity' => 'Foo']);
$metadataInfo->mapManyToOne(['fieldName' => 'relation2', 'targetEntity' => 'Foo']);
$metadataInfo->mapOneToMany(['fieldName' => 'relation3', 'targetEntity' => 'Foo', 'mappedBy' => 'baz']);
$metadataInfo->mapOneToOne(['fieldName' => 'relation4', 'targetEntity' => 'Foo']);
$overrides = [['original' => 'Foo\\Bar\\OriginalQux', 'override' => 'Acme\\Bar\\OverrideQux'], ['original' => 'Foo\\Baz\\OriginalQux', 'override' => 'Acme\\Baz\\OverrideQux']];
$this->configure($metadataInfo, $overrides, $configuration)->shouldBeAnOverrideModel();
}
示例4: testWriteEntityClass
public function testWriteEntityClass()
{
$metadata = new ClassMetadataInfo('EntityGeneratorBook');
$metadata->primaryTable['name'] = 'book';
$metadata->mapField(array('fieldName' => 'name', 'type' => 'string'));
$metadata->mapField(array('fieldName' => 'status', 'type' => 'string', 'default' => 'published'));
$metadata->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$metadata->mapOneToOne(array('fieldName' => 'author', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Tools\\EntityGeneratorAuthor', 'mappedBy' => 'book'));
$joinColumns = array(array('name' => 'author_id', 'referencedColumnName' => 'id'));
$metadata->mapManyToMany(array('fieldName' => 'comments', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Tools\\EntityGeneratorComment', 'joinTable' => array('name' => 'book_comment', 'joinColumns' => array(array('name' => 'book_id', 'referencedColumnName' => 'id')), 'inverseJoinColumns' => array(array('name' => 'comment_id', 'referencedColumnName' => 'id')))));
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
$this->_generator->writeEntityClass($metadata, __DIR__);
$path = __DIR__ . '/EntityGeneratorBook.php';
$this->assertTrue(file_exists($path));
require_once $path;
return $metadata;
}
示例5: generateBookEntityFixture
public function generateBookEntityFixture()
{
$metadata = new ClassMetadataInfo($this->_namespace . '\\EntityGeneratorBook');
$metadata->namespace = $this->_namespace;
$metadata->customRepositoryClassName = $this->_namespace . '\\EntityGeneratorBookRepository';
$metadata->table['name'] = 'book';
$metadata->mapField(array('fieldName' => 'name', 'type' => 'string'));
$metadata->mapField(array('fieldName' => 'status', 'type' => 'string', 'default' => 'published'));
$metadata->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$metadata->mapOneToOne(array('fieldName' => 'author', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Tools\\EntityGeneratorAuthor', 'mappedBy' => 'book'));
$joinColumns = array(array('name' => 'author_id', 'referencedColumnName' => 'id'));
$metadata->mapManyToMany(array('fieldName' => 'comments', 'targetEntity' => 'Doctrine\\Tests\\ORM\\Tools\\EntityGeneratorComment', 'joinTable' => array('name' => 'book_comment', 'joinColumns' => array(array('name' => 'book_id', 'referencedColumnName' => 'id')), 'inverseJoinColumns' => array(array('name' => 'comment_id', 'referencedColumnName' => 'id')))));
$metadata->addLifecycleCallback('loading', 'postLoad');
$metadata->addLifecycleCallback('willBeRemoved', 'preRemove');
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
$this->_generator->writeEntityClass($metadata, $this->_tmpDir);
return $metadata;
}
示例6: remapAssociation
/**
* @param \Doctrine\ORM\Mapping\ClassMetadataInfo $classMetadata
* @param array $mapping
*
* @return void
*/
private function remapAssociation($classMetadata, $mapping)
{
$newMapping = $this->resolveTargetEntities[$mapping['targetEntity']];
$newMapping = array_replace_recursive($mapping, $newMapping);
$newMapping['fieldName'] = $mapping['fieldName'];
unset($classMetadata->associationMappings[$mapping['fieldName']]);
switch ($mapping['type']) {
case ClassMetadata::MANY_TO_MANY:
$classMetadata->mapManyToMany($newMapping);
break;
case ClassMetadata::MANY_TO_ONE:
$classMetadata->mapManyToOne($newMapping);
break;
case ClassMetadata::ONE_TO_MANY:
$classMetadata->mapOneToMany($newMapping);
break;
case ClassMetadata::ONE_TO_ONE:
$classMetadata->mapOneToOne($newMapping);
break;
}
}
示例7: 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));
}
}
}
}
示例8: loadMetadataForClass
//.........这里部分代码省略.........
if (in_array($column->getName(), $allForeignKeyColumns)) {
continue;
} else {
if ($primaryKeyColumns && in_array($column->getName(), $primaryKeyColumns)) {
$fieldMapping['id'] = true;
}
}
$fieldMapping['fieldName'] = $this->getFieldNameForColumn($tableName, $column->getName(), false);
$fieldMapping['columnName'] = $column->getName();
$fieldMapping['type'] = strtolower((string) $column->getType());
if ($column->getType() instanceof \Doctrine\DBAL\Types\StringType) {
$fieldMapping['length'] = $column->getLength();
$fieldMapping['fixed'] = $column->getFixed();
} else {
if ($column->getType() instanceof \Doctrine\DBAL\Types\IntegerType) {
$fieldMapping['unsigned'] = $column->getUnsigned();
}
}
$fieldMapping['nullable'] = $column->getNotNull() ? false : true;
if (isset($fieldMapping['id'])) {
$ids[] = $fieldMapping;
} else {
$fieldMappings[] = $fieldMapping;
}
}
if ($ids) {
if (count($ids) == 1) {
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
}
foreach ($ids as $id) {
$metadata->mapField($id);
}
}
foreach ($fieldMappings as $fieldMapping) {
$metadata->mapField($fieldMapping);
}
foreach ($this->manyToManyTables as $manyTable) {
foreach ($manyTable->getForeignKeys() as $foreignKey) {
// foreign key maps to the table of the current entity, many to many association probably exists
if (strtolower($tableName) == strtolower($foreignKey->getForeignTableName())) {
$myFk = $foreignKey;
$otherFk = null;
foreach ($manyTable->getForeignKeys() as $foreignKey) {
if ($foreignKey != $myFk) {
$otherFk = $foreignKey;
break;
}
}
if (!$otherFk) {
// the definition of this many to many table does not contain
// enough foreign key information to continue reverse engeneering.
continue;
}
$localColumn = current($myFk->getColumns());
$associationMapping = array();
$associationMapping['fieldName'] = $this->getFieldNameForColumn($manyTable->getName(), current($otherFk->getColumns()), true);
$associationMapping['targetEntity'] = $this->getClassNameForTable($otherFk->getForeignTableName());
if (current($manyTable->getColumns())->getName() == $localColumn) {
$associationMapping['inversedBy'] = $this->getFieldNameForColumn($manyTable->getName(), current($myFk->getColumns()), true);
$associationMapping['joinTable'] = array('name' => strtolower($manyTable->getName()), 'joinColumns' => array(), 'inverseJoinColumns' => array());
$fkCols = $myFk->getForeignColumns();
$cols = $myFk->getColumns();
for ($i = 0; $i < count($cols); $i++) {
$associationMapping['joinTable']['joinColumns'][] = array('name' => $cols[$i], 'referencedColumnName' => $fkCols[$i]);
}
$fkCols = $otherFk->getForeignColumns();
$cols = $otherFk->getColumns();
for ($i = 0; $i < count($cols); $i++) {
$associationMapping['joinTable']['inverseJoinColumns'][] = array('name' => $cols[$i], 'referencedColumnName' => $fkCols[$i]);
}
} else {
$associationMapping['mappedBy'] = $this->getFieldNameForColumn($manyTable->getName(), current($myFk->getColumns()), true);
}
$metadata->mapManyToMany($associationMapping);
break;
}
}
}
foreach ($foreignKeys as $foreignKey) {
$foreignTable = $foreignKey->getForeignTableName();
$cols = $foreignKey->getColumns();
$fkCols = $foreignKey->getForeignColumns();
$localColumn = current($cols);
$associationMapping = array();
$associationMapping['fieldName'] = $this->getFieldNameForColumn($tableName, $localColumn, true);
$associationMapping['targetEntity'] = $this->getClassNameForTable($foreignTable);
if ($primaryKeyColumns && in_array($localColumn, $primaryKeyColumns)) {
$associationMapping['id'] = true;
}
for ($i = 0; $i < count($cols); $i++) {
$associationMapping['joinColumns'][] = array('name' => $cols[$i], 'referencedColumnName' => $fkCols[$i]);
}
//Here we need to check if $cols are the same as $primaryKeyColums
if (!array_diff($cols, $primaryKeyColumns)) {
$metadata->mapOneToOne($associationMapping);
} else {
$metadata->mapManyToOne($associationMapping);
}
}
}
示例9: loadMetadataForClass
//.........这里部分代码省略.........
$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;
}
$mapping['joinColumns'] = $joinColumns;
$mapping['cascade'] = $manyToOneAnnot->cascade;
$mapping['inversedBy'] = $manyToOneAnnot->inversedBy;
$mapping['targetEntity'] = $manyToOneAnnot->targetEntity;
$mapping['fetch'] = $this->getFetchMode($className, $manyToOneAnnot->fetch);
$metadata->mapManyToOne($mapping);
} else {
if ($manyToManyAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\ManyToMany')) {
$joinTable = array();
if ($joinTableAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\JoinTable')) {
$joinTable = array('name' => $joinTableAnnot->name, 'schema' => $joinTableAnnot->schema);
foreach ($joinTableAnnot->joinColumns as $joinColumn) {
$joinTable['joinColumns'][] = array('name' => $joinColumn->name, 'referencedColumnName' => $joinColumn->referencedColumnName, 'unique' => $joinColumn->unique, 'nullable' => $joinColumn->nullable, 'onDelete' => $joinColumn->onDelete, 'columnDefinition' => $joinColumn->columnDefinition);
}
foreach ($joinTableAnnot->inverseJoinColumns as $joinColumn) {
$joinTable['inverseJoinColumns'][] = array('name' => $joinColumn->name, 'referencedColumnName' => $joinColumn->referencedColumnName, 'unique' => $joinColumn->unique, 'nullable' => $joinColumn->nullable, 'onDelete' => $joinColumn->onDelete, 'columnDefinition' => $joinColumn->columnDefinition);
}
}
$mapping['joinTable'] = $joinTable;
$mapping['targetEntity'] = $manyToManyAnnot->targetEntity;
$mapping['mappedBy'] = $manyToManyAnnot->mappedBy;
$mapping['inversedBy'] = $manyToManyAnnot->inversedBy;
$mapping['cascade'] = $manyToManyAnnot->cascade;
$mapping['indexBy'] = $manyToManyAnnot->indexBy;
$mapping['orphanRemoval'] = $manyToManyAnnot->orphanRemoval;
$mapping['fetch'] = $this->getFetchMode($className, $manyToManyAnnot->fetch);
if ($orderByAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\OrderBy')) {
$mapping['orderBy'] = $orderByAnnot->value;
}
$metadata->mapManyToMany($mapping);
}
}
}
}
}
}
// Evaluate @HasLifecycleCallbacks annotation
if (isset($classAnnotations['Doctrine\\ORM\\Mapping\\HasLifecycleCallbacks'])) {
foreach ($class->getMethods() as $method) {
// filter for the declaring class only, callbacks from parents will already be registered.
if ($method->isPublic() && $method->getDeclaringClass()->getName() == $class->name) {
$annotations = $this->_reader->getMethodAnnotations($method);
// Compatibility with Doctrine Common 3.x
if ($annotations && is_int(key($annotations))) {
foreach ($annotations as $annot) {
$annotations[get_class($annot)] = $annot;
}
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PrePersist'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::prePersist);
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PostPersist'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::postPersist);
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PreUpdate'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::preUpdate);
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PostUpdate'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::postUpdate);
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PreRemove'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::preRemove);
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PostRemove'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::postRemove);
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PostLoad'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::postLoad);
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PreFlush'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::preFlush);
}
}
}
}
}
示例10: loadMetadataForClass
//.........这里部分代码省略.........
}
}
$mapping['joinColumns'] = $joinColumns;
}
if (isset($oneToOneElement->cascade)) {
$mapping['cascade'] = $this->_getCascadeMappings($oneToOneElement->cascade);
}
if (isset($oneToOneElement->{'orphan-removal'})) {
$mapping['orphanRemoval'] = (bool) $oneToOneElement->{'orphan-removal'};
}
$metadata->mapOneToOne($mapping);
}
}
// Evaluate <one-to-many ...> mappings
if (isset($xmlRoot->{'one-to-many'})) {
foreach ($xmlRoot->{'one-to-many'} as $oneToManyElement) {
$mapping = array('fieldName' => (string) $oneToManyElement['field'], 'targetEntity' => (string) $oneToManyElement['target-entity'], 'mappedBy' => (string) $oneToManyElement['mapped-by']);
if (isset($oneToManyElement['fetch'])) {
$mapping['fetch'] = constant('Doctrine\\ORM\\Mapping\\AssociationMapping::FETCH_' . (string) $oneToManyElement['fetch']);
}
if (isset($oneToManyElement->cascade)) {
$mapping['cascade'] = $this->_getCascadeMappings($oneToManyElement->cascade);
}
if (isset($oneToManyElement->{'orphan-removal'})) {
$mapping['orphanRemoval'] = (bool) $oneToManyElement->{'orphan-removal'};
}
$metadata->mapOneToMany($mapping);
}
}
// Evaluate <many-to-one ...> mappings
if (isset($xmlRoot->{'many-to-one'})) {
foreach ($xmlRoot->{'many-to-one'} as $manyToOneElement) {
$mapping = array('fieldName' => (string) $manyToOneElement['field'], 'targetEntity' => (string) $manyToOneElement['target-entity']);
if (isset($manyToOneElement['fetch'])) {
$mapping['fetch'] = constant('Doctrine\\ORM\\Mapping\\AssociationMapping::FETCH_' . (string) $manyToOneElement['fetch']);
}
$joinColumns = array();
if (isset($manyToOneElement->{'join-column'})) {
$joinColumns[] = $this->_getJoinColumnMapping($manyToOneElement->{'join-column'});
} else {
if (isset($manyToOneElement->{'join-columns'})) {
foreach ($manyToOneElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
if (!isset($joinColumnElement['name'])) {
$joinColumnElement['name'] = $name;
}
$joinColumns[] = $this->_getJoinColumnMapping($joinColumnElement);
}
}
}
$mapping['joinColumns'] = $joinColumns;
if (isset($manyToOneElement->cascade)) {
$mapping['cascade'] = $this->_getCascadeMappings($manyToOneElement->cascade);
}
if (isset($manyToOneElement->{'orphan-removal'})) {
$mapping['orphanRemoval'] = (bool) $manyToOneElement->{'orphan-removal'};
}
$metadata->mapManyToOne($mapping);
}
}
// Evaluate <many-to-many ...> mappings
if (isset($xmlRoot->{'many-to-many'})) {
foreach ($xmlRoot->{'many-to-many'} as $manyToManyElement) {
$mapping = array('fieldName' => (string) $manyToManyElement['field'], 'targetEntity' => (string) $manyToManyElement['target-entity']);
if (isset($manyToManyElement['fetch'])) {
$mapping['fetch'] = constant('Doctrine\\ORM\\Mapping\\AssociationMapping::FETCH_' . (string) $manyToManyElement['fetch']);
}
if (isset($manyToManyElement['mapped-by'])) {
$mapping['mappedBy'] = (string) $manyToManyElement['mapped-by'];
} else {
if (isset($manyToManyElement->{'join-table'})) {
$joinTableElement = $manyToManyElement->{'join-table'};
$joinTable = array('name' => (string) $joinTableElement['name']);
if (isset($joinTableElement['schema'])) {
$joinTable['schema'] = (string) $joinTableElement['schema'];
}
foreach ($joinTableElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
$joinTable['joinColumns'][] = $this->_getJoinColumnMapping($joinColumnElement);
}
foreach ($joinTableElement->{'inverse-join-columns'}->{'join-column'} as $joinColumnElement) {
$joinTable['inverseJoinColumns'][] = $this->_getJoinColumnMapping($joinColumnElement);
}
$mapping['joinTable'] = $joinTable;
}
}
if (isset($manyToManyElement->cascade)) {
$mapping['cascade'] = $this->_getCascadeMappings($manyToManyElement->cascade);
}
if (isset($manyToManyElement->{'orphan-removal'})) {
$mapping['orphanRemoval'] = (bool) $manyToManyElement->{'orphan-removal'};
}
$metadata->mapManyToMany($mapping);
}
}
// Evaluate <lifecycle-callbacks...>
if (isset($xmlRoot->{'lifecycle-callbacks'})) {
foreach ($xmlRoot->{'lifecycle-callbacks'}->{'lifecycle-callback'} as $lifecycleCallback) {
$metadata->addLifecycleCallback((string) $lifecycleCallback['method'], constant('\\Doctrine\\ORM\\Events::' . (string) $lifecycleCallback['type']));
}
}
}
示例11: loadMetadataForClass
//.........这里部分代码省略.........
}
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 ($versionAnnot = $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 ($tblGeneratorAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\TableGenerator')) {
throw MappingException::tableIdGeneratorNotImplemented($className);
}
}
} else {
if ($oneToOneAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\OneToOne')) {
$mapping['targetEntity'] = $oneToOneAnnot->targetEntity;
$mapping['joinColumns'] = $joinColumns;
$mapping['mappedBy'] = $oneToOneAnnot->mappedBy;
$mapping['cascade'] = $oneToOneAnnot->cascade;
$mapping['orphanRemoval'] = $oneToOneAnnot->orphanRemoval;
$mapping['fetch'] = constant('Doctrine\\ORM\\Mapping\\AssociationMapping::FETCH_' . $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['orphanRemoval'] = $oneToManyAnnot->orphanRemoval;
$mapping['fetch'] = constant('Doctrine\\ORM\\Mapping\\AssociationMapping::FETCH_' . $oneToManyAnnot->fetch);
$metadata->mapOneToMany($mapping);
} else {
if ($manyToOneAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\ManyToOne')) {
$mapping['joinColumns'] = $joinColumns;
$mapping['cascade'] = $manyToOneAnnot->cascade;
$mapping['targetEntity'] = $manyToOneAnnot->targetEntity;
$mapping['fetch'] = constant('Doctrine\\ORM\\Mapping\\AssociationMapping::FETCH_' . $manyToOneAnnot->fetch);
$metadata->mapManyToOne($mapping);
} else {
if ($manyToManyAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\ManyToMany')) {
$joinTable = array();
if ($joinTableAnnot = $this->_reader->getPropertyAnnotation($property, 'Doctrine\\ORM\\Mapping\\JoinTable')) {
$joinTable = array('name' => $joinTableAnnot->name, 'schema' => $joinTableAnnot->schema);
foreach ($joinTableAnnot->joinColumns as $joinColumn) {
$joinTable['joinColumns'][] = array('name' => $joinColumn->name, 'referencedColumnName' => $joinColumn->referencedColumnName, 'unique' => $joinColumn->unique, 'nullable' => $joinColumn->nullable, 'onDelete' => $joinColumn->onDelete, 'onUpdate' => $joinColumn->onUpdate, 'columnDefinition' => $joinColumn->columnDefinition);
}
foreach ($joinTableAnnot->inverseJoinColumns as $joinColumn) {
$joinTable['inverseJoinColumns'][] = array('name' => $joinColumn->name, 'referencedColumnName' => $joinColumn->referencedColumnName, 'unique' => $joinColumn->unique, 'nullable' => $joinColumn->nullable, 'onDelete' => $joinColumn->onDelete, 'onUpdate' => $joinColumn->onUpdate, 'columnDefinition' => $joinColumn->columnDefinition);
}
}
$mapping['joinTable'] = $joinTable;
$mapping['targetEntity'] = $manyToManyAnnot->targetEntity;
$mapping['mappedBy'] = $manyToManyAnnot->mappedBy;
$mapping['cascade'] = $manyToManyAnnot->cascade;
$mapping['fetch'] = constant('Doctrine\\ORM\\Mapping\\AssociationMapping::FETCH_' . $manyToManyAnnot->fetch);
$metadata->mapManyToMany($mapping);
}
}
}
}
}
}
// Evaluate HasLifecycleCallbacks annotation
if (isset($classAnnotations['Doctrine\\ORM\\Mapping\\HasLifecycleCallbacks'])) {
foreach ($class->getMethods() as $method) {
if ($method->isPublic()) {
$annotations = $this->_reader->getMethodAnnotations($method);
if (isset($annotations['Doctrine\\ORM\\Mapping\\PrePersist'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::prePersist);
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PostPersist'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::postPersist);
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PreUpdate'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::preUpdate);
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PostUpdate'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::postUpdate);
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PreRemove'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::preRemove);
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PostRemove'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::postRemove);
}
if (isset($annotations['Doctrine\\ORM\\Mapping\\PostLoad'])) {
$metadata->addLifecycleCallback($method->getName(), \Doctrine\ORM\Events::postLoad);
}
}
}
}
}
示例12: loadMetadataForClass
//.........这里部分代码省略.........
$foreignKeys = $this->tables[$tableName]->getForeignKeys();
} else {
$foreignKeys = array();
}
$allForeignKeyColumns = array();
foreach ($foreignKeys as $foreignKey) {
$allForeignKeyColumns = array_merge($allForeignKeyColumns, $foreignKey->getLocalColumns());
}
$ids = array();
$fieldMappings = array();
foreach ($columns as $column) {
$fieldMapping = array();
if ($primaryKeyColumns && in_array($column->getName(), $primaryKeyColumns)) {
$fieldMapping['id'] = true;
} else {
if (in_array($column->getName(), $allForeignKeyColumns)) {
continue;
}
}
$fieldMapping['fieldName'] = Inflector::camelize(strtolower($column->getName()));
$fieldMapping['columnName'] = $column->getName();
$fieldMapping['type'] = strtolower((string) $column->getType());
if ($column->getType() instanceof \Doctrine\DBAL\Types\StringType) {
$fieldMapping['length'] = $column->getLength();
$fieldMapping['fixed'] = $column->getFixed();
} else {
if ($column->getType() instanceof \Doctrine\DBAL\Types\IntegerType) {
$fieldMapping['unsigned'] = $column->getUnsigned();
}
}
$fieldMapping['nullable'] = $column->getNotNull() ? false : true;
if (isset($fieldMapping['id'])) {
$ids[] = $fieldMapping;
} else {
$fieldMappings[] = $fieldMapping;
}
}
if ($ids) {
if (count($ids) == 1) {
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
}
foreach ($ids as $id) {
$metadata->mapField($id);
}
}
foreach ($fieldMappings as $fieldMapping) {
$metadata->mapField($fieldMapping);
}
foreach ($this->manyToManyTables as $manyTable) {
foreach ($manyTable->getForeignKeys() as $foreignKey) {
if (strtolower($tableName) == strtolower($foreignKey->getForeignTableName())) {
$myFk = $foreignKey;
foreach ($manyTable->getForeignKeys() as $foreignKey) {
if ($foreignKey != $myFk) {
$otherFk = $foreignKey;
break;
}
}
if ($otherFk === NULL) {
continue;
}
$localColumn = current($myFk->getColumns());
$associationMapping = array();
$associationMapping['fieldName'] = Inflector::camelize(str_replace('_id', '', strtolower(current($otherFk->getColumns()))));
$associationMapping['targetEntity'] = Inflector::classify(strtolower($otherFk->getForeignTableName()));
if (current($manyTable->getColumns())->getName() == $localColumn) {
$associationMapping['inversedBy'] = Inflector::camelize(str_replace('_id', '', strtolower(current($myFk->getColumns()))));
$associationMapping['joinTable'] = array('name' => strtolower($manyTable->getName()), 'joinColumns' => array(), 'inverseJoinColumns' => array());
$fkCols = $myFk->getForeignColumns();
$cols = $myFk->getColumns();
for ($i = 0; $i < count($cols); $i++) {
$associationMapping['joinTable']['joinColumns'][] = array('name' => $cols[$i], 'referencedColumnName' => $fkCols[$i]);
}
$fkCols = $otherFk->getForeignColumns();
$cols = $otherFk->getColumns();
for ($i = 0; $i < count($cols); $i++) {
$associationMapping['joinTable']['inverseJoinColumns'][] = array('name' => $cols[$i], 'referencedColumnName' => $fkCols[$i]);
}
} else {
$associationMapping['mappedBy'] = Inflector::camelize(str_replace('_id', '', strtolower(current($myFk->getColumns()))));
}
$metadata->mapManyToMany($associationMapping);
break;
}
}
}
foreach ($foreignKeys as $foreignKey) {
$foreignTable = $foreignKey->getForeignTableName();
$cols = $foreignKey->getColumns();
$fkCols = $foreignKey->getForeignColumns();
$localColumn = current($cols);
$associationMapping = array();
$associationMapping['fieldName'] = Inflector::camelize(str_replace('_id', '', strtolower($localColumn)));
$associationMapping['targetEntity'] = Inflector::classify($foreignTable);
for ($i = 0; $i < count($cols); $i++) {
$associationMapping['joinColumns'][] = array('name' => $cols[$i], 'referencedColumnName' => $fkCols[$i]);
}
$metadata->mapManyToOne($associationMapping);
}
}
示例13: mapManyToManyField
private function mapManyToManyField($name, array $mapping, ClassMetadataInfo $metadata)
{
$manyToMany = array('fieldName' => $name, 'targetEntity' => $mapping['typeParenthese']);
if (isset($mapping['targetEntity'])) {
$manyToOne['targetEntity'] = $mapping['targetEntity'];
}
if (isset($mapping['fetch'])) {
$manyToOne['fetch'] = constant(sprintf('Doctrine\\ORM\\Mapping\\ClassMetadata::FETCH_%s', $mapping['fetch']));
}
if (isset($mapping['mappedBy'])) {
$manyToMany['mappedBy'] = $mapping['mappedBy'];
} else {
if (isset($mapping['joinTable'])) {
if (isset($mapping['inversedBy'])) {
$manyToMany['inversedBy'] = $mapping['inversedBy'];
}
$joinTableMapping = $mapping['joinTable'];
$joinTable = array('name' => $joinTableMapping['name']);
if (isset($joinTableMapping['schema'])) {
$joinTable['schema'] = $joinTableMapping['schema'];
}
foreach ($joinTableMapping['joinColumns'] as $name => $joinColumnMapping) {
if (!isset($joinColumnMapping['name'])) {
$joinColumnMapping['name'] = $name;
}
$joinTable['joinColumns'][] = $this->getJoinColumnMapping($joinColumnMapping);
}
foreach ($joinTableMapping['inverseJoinColumns'] as $name => $joinColumnMapping) {
if (!isset($joinColumnMapping['name'])) {
$joinColumnMapping['name'] = $name;
}
$joinTable['inverseJoinColumns'][] = $this->getJoinColumnMapping($joinColumnMapping);
}
$mapping['joinTable'] = $joinTable;
}
}
if (isset($mapping['cascade'])) {
$manyToMany['cascade'] = $mapping['cascade'];
}
if (isset($mapping['orphanRemoval'])) {
$manyToMany['orphanRemoval'] = (bool) $mapping['orphanRemoval'];
}
if (isset($mapping['orderBy'])) {
$manyToMany['orderBy'] = $mapping['orderBy'];
}
if (isset($mapping['indexBy'])) {
$manyToMany['indexBy'] = $mapping['indexBy'];
}
$metadata->mapManyToMany($manyToMany);
}
示例14: testGenerateEntityWithMultipleInverseJoinColumns
/**
* @group DDC-2079
*/
public function testGenerateEntityWithMultipleInverseJoinColumns()
{
$metadata = new ClassMetadataInfo($this->_namespace . '\\DDC2079Entity');
$metadata->namespace = $this->_namespace;
$metadata->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE);
$metadata->mapManyToMany(array('fieldName' => 'centroCustos', 'targetEntity' => 'DDC2079CentroCusto', 'joinTable' => array('name' => 'unidade_centro_custo', 'joinColumns' => array(array('name' => 'idorcamento', 'referencedColumnName' => 'idorcamento'), array('name' => 'idunidade', 'referencedColumnName' => 'idunidade')), 'inverseJoinColumns' => array(array('name' => 'idcentrocusto', 'referencedColumnName' => 'idcentrocusto'), array('name' => 'idpais', 'referencedColumnName' => 'idpais')))));
$this->_generator->writeEntityClass($metadata, $this->_tmpDir);
$filename = $this->_tmpDir . DIRECTORY_SEPARATOR . $this->_namespace . DIRECTORY_SEPARATOR . 'DDC2079Entity.php';
$this->assertFileExists($filename);
require_once $filename;
$property = new \ReflectionProperty($metadata->name, 'centroCustos');
$docComment = $property->getDocComment();
//joinColumns
$this->assertContains('@JoinColumn(name="idorcamento", referencedColumnName="idorcamento"),', $docComment);
$this->assertContains('@JoinColumn(name="idunidade", referencedColumnName="idunidade")', $docComment);
//inverseJoinColumns
$this->assertContains('@JoinColumn(name="idcentrocusto", referencedColumnName="idcentrocusto"),', $docComment);
$this->assertContains('@JoinColumn(name="idpais", referencedColumnName="idpais")', $docComment);
}
示例15: evaluatePropertyAnnotations
//.........这里部分代码省略.........
}
$mapping['inversedBy'] = $manyToOneAnnotation->inversedBy;
$mapping['fetch'] = $this->getFetchMode($className, $manyToOneAnnotation->fetch);
$metadata->mapManyToOne($mapping);
} elseif ($manyToManyAnnotation = $this->reader->getPropertyAnnotation($property, ORM\ManyToMany::class)) {
if ($manyToManyAnnotation->targetEntity) {
$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) {