composite identifier, but uses an ID generator other than manually assigning + Symfony2
I think this line (in Item
):
/** * @ORM\DiscriminatorMap({"ITEM"="Item", "ARTICLE"="Article" "IMAGE"="Media"}) */
should be:
/** * @ORM\DiscriminatorMap({"ITEM"="Item", "ARTICLE"="Article", "IMAGE"="Media"}) * ^ */
I'm not really sure, but it could be that the discriminator map needs fully qualified classnames:
/** * @ORM\DiscriminatorMap({ * "ITEM"="Beachteam\BeachteamBundle\Entity\Item", * "ARTICLE"="Beachteam\BeachteamBundle\Entity\Article", * "IMAGE"="Beachteam\BeachteamBundle\Entity\Media" * }) */
Next you will need to remove the property $type
from Item
, because type
is already used as discriminator column.
You might also want to use the console to validate your mappings:
app/console doctrine:schema:validate
Fix all errors that might be reported.
update
Property Beachteam\BeachteamBundle\Entity\Item::$type does not exist
This means that somewhere in the code the (now non-existent) property $type
of class Item
is still being used. You'll have to track down where.
- Search your code for
->type
. - Clear the cache (delete the content of the
app/cache
folder and runapp/console cache:clear
.
I think that you planed Item::$type attribute while generating doctrine as a inheritance attribute. But this is also created by annotation:
@ORM\DiscriminatorColumn(name="type", type="string")
You have part of a table key and field with the same name. Try to remove class attribute (and getter, setter method), then update schema
php app/console doctrine:schema:update --force
After this change your classes works like a charm on my box
Good Luck!