mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-2387: convert-mapping not working correctly with composite primary keys/foreign keys in 2.4.0-RC1 #2997
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Apr 3, 2013).
Originally assigned to: @Majkl578 on GitHub.
Jira issue originally created by user succinct:
(Apologies if this is somehow a Symfony-specific issue)
I updated my application via Composer yesterday, and received Doctrine 2.4.0-RC1. After this update, generating entities has been problematic under certain circumstances.
Here is an example table in MySQL:
In Doctrine 2.3, the mapping works correctly, and you end up with a 3-part primary key, with a user property mapped to the User entity, and a datasourceCode property mapped to the DatasourceCode entity. All good.
In 2.4, the following error is given:
Single id is not allowed on composite primary key in entity UserEmail.Removing one of the foreign keys in the table (either to User or DatasourceCode) but keeping the primary key set to all 3 columns allows the mapping to work. But, if you then remove one of the columns from the primary key (say, email_datasource) it fails again.
@doctrinebot commented on GitHub (Apr 4, 2013):
Comment created by @beberlei:
Can you provide the full stack trace to the exception please?
@doctrinebot commented on GitHub (Apr 11, 2013):
Comment created by succinct:
Benjamin, I'm not sure how to get the trace for you, since I'm running from inside the Symfony2 doctrine:mapping:import command line item.
@doctrinebot commented on GitHub (Apr 11, 2013):
Comment created by stof:
Use the
--verboseoption when running the command@doctrinebot commented on GitHub (Apr 11, 2013):
Comment created by succinct:
I was able to get a trace for you:
@doctrinebot commented on GitHub (Apr 14, 2013):
Comment created by @beberlei:
The problem is that Doctrine seems to detect that you only have on id field on this entity and then a new function of 2.4 throws this error. I will try to reproduce this with your table. Until then could you show me the var_dump() of the $class variable in Doctrine\ORM\ClassMetadataFactory#completeIdGeneratorMapping()? This would help very much already.
@doctrinebot commented on GitHub (Apr 15, 2013):
Comment created by maximilian:
I have the same error when using "doctrine:mapping:import"
```CREATE TABLE IF NOT EXISTS
dev_Recipe.step(recipe_idINT NOT NULL ,step_numberINT NOT NULL ,descriptionTEXT NULL ,timerINT NULL ,imageVARCHAR(100) NULL ,PRIMARY KEY (
recipe*id,step*number) ,INDEX
recipe*id_idx(recipe*idASC) ,INDEX
step*number(step*numberASC) ,CONSTRAINT
step*recipe*idENGINE = InnoDB;```
Exception trace: () at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\MappingException.php:258 Doctrine\ORM\Mapping\MappingException::singleIdNotAllowedOnCompositePrimaryKey() at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataInfo.php:1571 Doctrine\ORM\Mapping\ClassMetadataInfo->getSingleIdentifierFieldName() at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataFactory.php:422 Doctrine\ORM\Mapping\ClassMetadataFactory->completeIdGeneratorMapping() at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataFactory.php:136 Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata() at \htdocs\SF2\vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php:302 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at \htdocs\SF2\vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php:212 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at \htdocs\SF2\vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php:112 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata() at \htdocs\SF2\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand.php:126 Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand->execute() at \htdocs\SF2\vendor\doctrine\doctrine-bundle\Doctrine\Bundle\DoctrineBundle\Command\Proxy\ConvertMappingDoctrineCommand.php:59 Doctrine\Bundle\DoctrineBundle\Command\Proxy\ConvertMappingDoctrineCommand->execute() at \htdocs\SF2\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:240 Symfony\Component\Console\Command\Command->run() at \htdocs\SF2\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:193 Symfony\Component\Console\Application->doRun() at \htdocs\SF2\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:78 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at \htdocs\SF2\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:106 Symfony\Component\Console\Application->run() at \htdocs\SF2\app\console:22"var_dump($class);" returns:
object(Doctrine\ORM\Mapping\ClassMetadata)#470 (36) { ["name"]=> string(10) "Ingredient" ["namespace"]=> string(0) "" ["rootEntityName"]=> string(10) "Ingredient" ["customGeneratorDefinition"]=> NULL ["customRepositoryClassName"]=> NULL ["isMappedSuperclass"]=> bool(false) ["parentClasses"]=> array(0) { } ["subClasses"]=> array(0) { } ["namedQueries"]=> array(0) { } ["namedNativeQueries"]=> array(0) { } ["sqlResultSetMappings"]=> array(0) { } ["identifier"]=> array(1) { [0]=> string(12) "ingredientId" } ["inheritanceType"]=> int(1) ["generatorType"]=> int(1) ["fieldMappings"]=> array(4) { ["ingredientId"]=> array(6) { ["id"]=> bool(true) ["fieldName"]=> string(12) "ingredientId" ["columnName"]=> string(13) "ingredient_id" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(false) } ["name"]=> array(6) { ["fieldName"]=> string(4) "name" ["columnName"]=> string(4) "name" ["type"]=> string(6) "string" ["length"]=> int(45) ["fixed"]=> bool(false) ["nullable"]=> bool(false) } ["color"]=> array(5) { ["fieldName"]=> string(5) "color" ["columnName"]=> string(5) "color" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(false) } ["img"]=> array(6) { ["fieldName"]=> string(3) "img" ["columnName"]=> string(3) "img" ["type"]=> string(6) "string" ["length"]=> int(45) ["fixed"]=> bool(false) ["nullable"]=> bool(true) } } ["fieldNames"]=> array(4) { ["ingredient_id"]=> string(12) "ingredientId" ["name"]=> string(4) "name" ["color"]=> string(5) "color" ["img"]=> string(3) "img" } ["columnNames"]=> array(4) { ["ingredientId"]=> string(13) "ingredient_id" ["name"]=> string(4) "name" ["color"]=> string(5) "color" ["img"]=> string(3) "img" } ["discriminatorValue"]=> NULL ["discriminatorMap"]=> array(0) { } ["discriminatorColumn"]=> NULL ["table"]=> array(1) { ["name"]=> string(10) "ingredient" } ["lifecycleCallbacks"]=> array(0) { } ["associationMappings"]=> array(1) { ["ingredientCategory"]=> array(15) { ["fieldName"]=> string(18) "ingredientCategory" ["targetEntity"]=> string(18) "IngredientCategory" ["mappedBy"]=> string(10) "ingredient" ["type"]=> int(8) ["inversedBy"]=> NULL ["isOwningSide"]=> bool(false) ["sourceEntity"]=> string(10) "Ingredient" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["orphanRemoval"]=> bool(false) } } ["isIdentifierComposite"]=> bool(false) ["containsForeignIdentifier"]=> bool(false) ["idGenerator"]=> NULL ["sequenceGeneratorDefinition"]=> NULL ["tableGeneratorDefinition"]=> NULL ["changeTrackingPolicy"]=> int(1) ["isVersioned"]=> NULL ["versionField"]=> NULL ["reflClass"]=> NULL ["isReadOnly"]=> bool(false) ["namingStrategy":protected]=> object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) { } ["reflFields"]=> array(0) { } ["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=> NULL } object(Doctrine\ORM\Mapping\ClassMetadata)#472 (36) { ["name"]=> string(18) "IngredientCategory" ["namespace"]=> string(0) "" ["rootEntityName"]=> string(18) "IngredientCategory" ["customGeneratorDefinition"]=> NULL ["customRepositoryClassName"]=> NULL ["isMappedSuperclass"]=> bool(false) ["parentClasses"]=> array(0) { } ["subClasses"]=> array(0) { } ["namedQueries"]=> array(0) { } ["namedNativeQueries"]=> array(0) { } ["sqlResultSetMappings"]=> array(0) { } ["identifier"]=> array(1) { [0]=> string(2) "id" } ["inheritanceType"]=> int(1) ["generatorType"]=> int(1) ["fieldMappings"]=> array(3) { ["id"]=> array(6) { ["id"]=> bool(true) ["fieldName"]=> string(2) "id" ["columnName"]=> string(2) "id" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(false) } ["name"]=> array(6) { ["fieldName"]=> string(4) "name" ["columnName"]=> string(4) "name" ["type"]=> string(6) "string" ["length"]=> int(255) ["fixed"]=> bool(false) ["nullable"]=> bool(false) } ["description"]=> array(4) { ["fieldName"]=> string(11) "description" ["columnName"]=> string(11) "description" ["type"]=> string(4) "text" ["nullable"]=> bool(true) } } ["fieldNames"]=> array(3) { ["id"]=> string(2) "id" ["name"]=> string(4) "name" ["description"]=> string(11) "description" } ["columnNames"]=> array(3) { ["id"]=> string(2) "id" ["name"]=> string(4) "name" ["description"]=> string(11) "description" } ["discriminatorValue"]=> NULL ["discriminatorMap"]=> array(0) { } ["discriminatorColumn"]=> NULL ["table"]=> array(1) { ["name"]=> string(19) "ingredient_category" } ["lifecycleCallbacks"]=> array(0) { } ["associationMappings"]=> array(2) { ["ingredient"]=> array(19) { ["fieldName"]=> string(10) "ingredient" ["targetEntity"]=> string(10) "Ingredient" ["inversedBy"]=> string(18) "ingredientCategory" ["joinTable"]=> array(3) { ["name"]=> string(30) "ingredient*category*ingredient" ["joinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(22) "ingredient*category*id" ["referencedColumnName"]=> string(2) "id" } } ["inverseJoinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(13) "ingredient_id" ["referencedColumnName"]=> string(13) "ingredient_id" } } } ["type"]=> int(8) ["mappedBy"]=> NULL ["isOwningSide"]=> bool(true) ["sourceEntity"]=> string(18) "IngredientCategory" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["joinTableColumns"]=> array(2) { [0]=> string(22) "ingredient*category*id" [1]=> string(13) "ingredient_id" } ["relationToSourceKeyColumns"]=> array(1) { ["ingredient*category*id"]=> string(2) "id" } ["relationToTargetKeyColumns"]=> array(1) { ["ingredient_id"]=> string(13) "ingredient_id" } ["orphanRemoval"]=> bool(false) } ["parent"]=> array(19) { ["fieldName"]=> string(6) "parent" ["targetEntity"]=> string(18) "IngredientCategory" ["joinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(9) "parent_id" ["referencedColumnName"]=> string(2) "id" } } ["type"]=> int(2) ["mappedBy"]=> NULL ["inversedBy"]=> NULL ["isOwningSide"]=> bool(true) ["sourceEntity"]=> string(18) "IngredientCategory" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["sourceToTargetKeyColumns"]=> array(1) { ["parent_id"]=> string(2) "id" } ["joinColumnFieldNames"]=> array(1) { ["parent_id"]=> string(9) "parent_id" } ["targetToSourceKeyColumns"]=> array(1) { ["id"]=> string(9) "parent_id" } ["orphanRemoval"]=> bool(false) } } ["isIdentifierComposite"]=> bool(false) ["containsForeignIdentifier"]=> bool(false) ["idGenerator"]=> NULL ["sequenceGeneratorDefinition"]=> NULL ["tableGeneratorDefinition"]=> NULL ["changeTrackingPolicy"]=> int(1) ["isVersioned"]=> NULL ["versionField"]=> NULL ["reflClass"]=> NULL ["isReadOnly"]=> bool(false) ["namingStrategy":protected]=> object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) { } ["reflFields"]=> array(0) { } ["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=> NULL } object(Doctrine\ORM\Mapping\ClassMetadata)#474 (36) { ["name"]=> string(6) "Recipe" ["namespace"]=> string(0) "" ["rootEntityName"]=> string(6) "Recipe" ["customGeneratorDefinition"]=> NULL ["customRepositoryClassName"]=> NULL ["isMappedSuperclass"]=> bool(false) ["parentClasses"]=> array(0) { } ["subClasses"]=> array(0) { } ["namedQueries"]=> array(0) { } ["namedNativeQueries"]=> array(0) { } ["sqlResultSetMappings"]=> array(0) { } ["identifier"]=> array(1) { [0]=> string(8) "recipeId" } ["inheritanceType"]=> int(1) ["generatorType"]=> int(1) ["fieldMappings"]=> array(3) { ["recipeId"]=> array(6) { ["id"]=> bool(true) ["fieldName"]=> string(8) "recipeId" ["columnName"]=> string(9) "recipe_id" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(false) } ["name"]=> array(6) { ["fieldName"]=> string(4) "name" ["columnName"]=> string(4) "name" ["type"]=> string(6) "string" ["length"]=> int(255) ["fixed"]=> bool(false) ["nullable"]=> bool(false) } ["description"]=> array(4) { ["fieldName"]=> string(11) "description" ["columnName"]=> string(11) "description" ["type"]=> string(4) "text" ["nullable"]=> bool(true) } } ["fieldNames"]=> array(3) { ["recipe_id"]=> string(8) "recipeId" ["name"]=> string(4) "name" ["description"]=> string(11) "description" } ["columnNames"]=> array(3) { ["recipeId"]=> string(9) "recipe_id" ["name"]=> string(4) "name" ["description"]=> string(11) "description" } ["discriminatorValue"]=> NULL ["discriminatorMap"]=> array(0) { } ["discriminatorColumn"]=> NULL ["table"]=> array(1) { ["name"]=> string(6) "recipe" } ["lifecycleCallbacks"]=> array(0) { } ["associationMappings"]=> array(2) { ["recipeCategory"]=> array(15) { ["fieldName"]=> string(14) "recipeCategory" ["targetEntity"]=> string(14) "RecipeCategory" ["mappedBy"]=> string(6) "recipe" ["type"]=> int(8) ["inversedBy"]=> NULL ["isOwningSide"]=> bool(false) ["sourceEntity"]=> string(6) "Recipe" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["orphanRemoval"]=> bool(false) } ["users"]=> array(19) { ["fieldName"]=> string(5) "users" ["targetEntity"]=> string(5) "Users" ["inversedBy"]=> string(12) "recipeRecipe" ["joinTable"]=> array(3) { ["name"]=> string(13) "users_recipes" ["joinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(16) "recipe*recipe*id" ["referencedColumnName"]=> string(9) "recipe_id" } } ["inverseJoinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(8) "users_id" ["referencedColumnName"]=> string(2) "id" } } } ["type"]=> int(8) ["mappedBy"]=> NULL ["isOwningSide"]=> bool(true) ["sourceEntity"]=> string(6) "Recipe" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["joinTableColumns"]=> array(2) { [0]=> string(16) "recipe*recipe*id" [1]=> string(8) "users_id" } ["relationToSourceKeyColumns"]=> array(1) { ["recipe*recipe*id"]=> string(9) "recipe_id" } ["relationToTargetKeyColumns"]=> array(1) { ["users_id"]=> string(2) "id" } ["orphanRemoval"]=> bool(false) } } ["isIdentifierComposite"]=> bool(false) ["containsForeignIdentifier"]=> bool(false) ["idGenerator"]=> NULL ["sequenceGeneratorDefinition"]=> NULL ["tableGeneratorDefinition"]=> NULL ["changeTrackingPolicy"]=> int(1) ["isVersioned"]=> NULL ["versionField"]=> NULL ["reflClass"]=> NULL ["isReadOnly"]=> bool(false) ["namingStrategy":protected]=> object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) { } ["reflFields"]=> array(0) { } ["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=> NULL } object(Doctrine\ORM\Mapping\ClassMetadata)#476 (36) { ["name"]=> string(14) "RecipeCategory" ["namespace"]=> string(0) "" ["rootEntityName"]=> string(14) "RecipeCategory" ["customGeneratorDefinition"]=> NULL ["customRepositoryClassName"]=> NULL ["isMappedSuperclass"]=> bool(false) ["parentClasses"]=> array(0) { } ["subClasses"]=> array(0) { } ["namedQueries"]=> array(0) { } ["namedNativeQueries"]=> array(0) { } ["sqlResultSetMappings"]=> array(0) { } ["identifier"]=> array(1) { [0]=> string(2) "id" } ["inheritanceType"]=> int(1) ["generatorType"]=> int(1) ["fieldMappings"]=> array(3) { ["id"]=> array(6) { ["id"]=> bool(true) ["fieldName"]=> string(2) "id" ["columnName"]=> string(2) "id" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(false) } ["name"]=> array(6) { ["fieldName"]=> string(4) "name" ["columnName"]=> string(4) "name" ["type"]=> string(6) "string" ["length"]=> int(45) ["fixed"]=> bool(false) ["nullable"]=> bool(false) } ["description"]=> array(6) { ["fieldName"]=> string(11) "description" ["columnName"]=> string(11) "description" ["type"]=> string(6) "string" ["length"]=> int(45) ["fixed"]=> bool(false) ["nullable"]=> bool(true) } } ["fieldNames"]=> array(3) { ["id"]=> string(2) "id" ["name"]=> string(4) "name" ["description"]=> string(11) "description" } ["columnNames"]=> array(3) { ["id"]=> string(2) "id" ["name"]=> string(4) "name" ["description"]=> string(11) "description" } ["discriminatorValue"]=> NULL ["discriminatorMap"]=> array(0) { } ["discriminatorColumn"]=> NULL ["table"]=> array(1) { ["name"]=> string(15) "recipe_category" } ["lifecycleCallbacks"]=> array(0) { } ["associationMappings"]=> array(2) { ["recipe"]=> array(19) { ["fieldName"]=> string(6) "recipe" ["targetEntity"]=> string(6) "Recipe" ["inversedBy"]=> string(14) "recipeCategory" ["joinTable"]=> array(3) { ["name"]=> string(22) "recipe*category*recipe" ["joinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(18) "recipe*category*id" ["referencedColumnName"]=> string(2) "id" } } ["inverseJoinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(9) "recipe_id" ["referencedColumnName"]=> string(9) "recipe_id" } } } ["type"]=> int(8) ["mappedBy"]=> NULL ["isOwningSide"]=> bool(true) ["sourceEntity"]=> string(14) "RecipeCategory" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["joinTableColumns"]=> array(2) { [0]=> string(18) "recipe*category*id" [1]=> string(9) "recipe_id" } ["relationToSourceKeyColumns"]=> array(1) { ["recipe*category*id"]=> string(2) "id" } ["relationToTargetKeyColumns"]=> array(1) { ["recipe_id"]=> string(9) "recipe_id" } ["orphanRemoval"]=> bool(false) } ["parent"]=> array(19) { ["fieldName"]=> string(6) "parent" ["targetEntity"]=> string(14) "RecipeCategory" ["joinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(9) "parent_id" ["referencedColumnName"]=> string(2) "id" } } ["type"]=> int(2) ["mappedBy"]=> NULL ["inversedBy"]=> NULL ["isOwningSide"]=> bool(true) ["sourceEntity"]=> string(14) "RecipeCategory" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["sourceToTargetKeyColumns"]=> array(1) { ["parent_id"]=> string(2) "id" } ["joinColumnFieldNames"]=> array(1) { ["parent_id"]=> string(9) "parent_id" } ["targetToSourceKeyColumns"]=> array(1) { ["id"]=> string(9) "parent_id" } ["orphanRemoval"]=> bool(false) } } ["isIdentifierComposite"]=> bool(false) ["containsForeignIdentifier"]=> bool(false) ["idGenerator"]=> NULL ["sequenceGeneratorDefinition"]=> NULL ["tableGeneratorDefinition"]=> NULL ["changeTrackingPolicy"]=> int(1) ["isVersioned"]=> NULL ["versionField"]=> NULL ["reflClass"]=> NULL ["isReadOnly"]=> bool(false) ["namingStrategy":protected]=> object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) { } ["reflFields"]=> array(0) { } ["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=> NULL } object(Doctrine\ORM\Mapping\ClassMetadata)#478 (36) { ["name"]=> string(4) "Step" ["namespace"]=> string(0) "" ["rootEntityName"]=> string(4) "Step" ["customGeneratorDefinition"]=> NULL ["customRepositoryClassName"]=> NULL ["isMappedSuperclass"]=> bool(false) ["parentClasses"]=> array(0) { } ["subClasses"]=> array(0) { } ["namedQueries"]=> array(0) { } ["namedNativeQueries"]=> array(0) { } ["sqlResultSetMappings"]=> array(0) { } ["identifier"]=> array(2) { [0]=> string(10) "stepNumber" [1]=> string(6) "recipe" } ["inheritanceType"]=> int(1) ["generatorType"]=> int(1) ["fieldMappings"]=> array(4) { ["stepNumber"]=> array(6) { ["id"]=> bool(true) ["fieldName"]=> string(10) "stepNumber" ["columnName"]=> string(11) "step_number" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(false) } ["description"]=> array(4) { ["fieldName"]=> string(11) "description" ["columnName"]=> string(11) "description" ["type"]=> string(4) "text" ["nullable"]=> bool(true) } ["timer"]=> array(5) { ["fieldName"]=> string(5) "timer" ["columnName"]=> string(5) "timer" ["type"]=> string(7) "integer" ["unsigned"]=> bool(false) ["nullable"]=> bool(true) } ["image"]=> array(6) { ["fieldName"]=> string(5) "image" ["columnName"]=> string(5) "image" ["type"]=> string(6) "string" ["length"]=> int(100) ["fixed"]=> bool(false) ["nullable"]=> bool(true) } } ["fieldNames"]=> array(4) { ["step_number"]=> string(10) "stepNumber" ["description"]=> string(11) "description" ["timer"]=> string(5) "timer" ["image"]=> string(5) "image" } ["columnNames"]=> array(4) { ["stepNumber"]=> string(11) "step_number" ["description"]=> string(11) "description" ["timer"]=> string(5) "timer" ["image"]=> string(5) "image" } ["discriminatorValue"]=> NULL ["discriminatorMap"]=> array(0) { } ["discriminatorColumn"]=> NULL ["table"]=> array(1) { ["name"]=> string(4) "step" } ["lifecycleCallbacks"]=> array(0) { } ["associationMappings"]=> array(1) { ["recipe"]=> array(20) { ["fieldName"]=> string(6) "recipe" ["targetEntity"]=> string(6) "Recipe" ["id"]=> bool(true) ["joinColumns"]=> array(1) { [0]=> array(2) { ["name"]=> string(9) "recipe_id" ["referencedColumnName"]=> string(9) "recipe_id" } } ["type"]=> int(1) ["mappedBy"]=> NULL ["inversedBy"]=> NULL ["isOwningSide"]=> bool(true) ["sourceEntity"]=> string(4) "Step" ["fetch"]=> int(2) ["cascade"]=> array(0) { } ["isCascadeRemove"]=> bool(false) ["isCascadePersist"]=> bool(false) ["isCascadeRefresh"]=> bool(false) ["isCascadeMerge"]=> bool(false) ["isCascadeDetach"]=> bool(false) ["sourceToTargetKeyColumns"]=> array(1) { ["recipe_id"]=> string(9) "recipe_id" } ["joinColumnFieldNames"]=> array(1) { ["recipe_id"]=> string(9) "recipe_id" } ["targetToSourceKeyColumns"]=> array(1) { ["recipe_id"]=> string(9) "recipe_id" } ["orphanRemoval"]=> bool(false) } } ["isIdentifierComposite"]=> bool(true) ["containsForeignIdentifier"]=> bool(true) ["idGenerator"]=> NULL ["sequenceGeneratorDefinition"]=> NULL ["tableGeneratorDefinition"]=> NULL ["changeTrackingPolicy"]=> int(1) ["isVersioned"]=> NULL ["versionField"]=> NULL ["reflClass"]=> NULL ["isReadOnly"]=> bool(false) ["namingStrategy":protected]=> object(Doctrine\ORM\Mapping\DefaultNamingStrategy)#258 (0) { } ["reflFields"]=> array(0) { } ["_prototype":"Doctrine\ORM\Mapping\ClassMetadataInfo":private]=> NULL }@doctrinebot commented on GitHub (May 9, 2013):
Comment created by @beberlei:
Fixed and merged back to 2.3
@doctrinebot commented on GitHub (May 29, 2013):
Comment created by succinct:
I tested this again using 2.3.4 (the version which contains this fix) and it is still occurring. Attempting to import mapping for a table with 2 foreign keys in the primary key results in the error "Database does not have any mapping information." Adding a third column on the primary key "fixes" the issue.
Currently our developers are being asked to add a fake third part to the key to work around the issue, then delete that key once they get into the entity class. This is a bit tedious and I'd love to see a fix!
@doctrinebot commented on GitHub (May 29, 2013):
Comment created by succinct:
Issue still present in 2.3.4 and 2.4.0-RC1
@doctrinebot commented on GitHub (Jun 11, 2013):
Comment created by guillermoespinoza:
The database engine I use is PostgreSQL. I'm having problems when mapping entities with composite primary keys in other tables.
Defining the entity establecimientoSecPlano, $establecimientoSec variable containing the keys $establecimiento and $id_establecimiento_sec
//Entity/EstablecimientosSecPlano
//Entity/EstablecimientosSec
When executing the command doctrine: mapping: import I get the following error
[Doctrine\ORM\Mapping\MappingException]
It is not possible to map entity 'EstablecimientoSec' with a composite primary key as part of the
primary key of another entity 'EstablecimientoSecPlano#idEstablecimiento'.
@doctrinebot commented on GitHub (Jun 28, 2013):
Comment created by samvdb:
We are having the same problem as Guillermo. Any idea on how to fix this issue?
Does anybody know why this problem occurs? I have been looking in the code but havent had much success.
@doctrinebot commented on GitHub (Jul 1, 2013):
Comment created by diegotdai:
Doesn't work for me either, composite keys aren't working in 2.3.4
Can we get a fix for this?
@doctrinebot commented on GitHub (Dec 31, 2014):
Comment created by kamil:
I have similar issue in my current project. Is there any chance to solve this problem in the near future?
Composite primary/foreign keys are important...
@Majkl578 commented on GitHub (Dec 19, 2017):
convert-mapping is scheduled for removal in Doctrine 3.0.