I’d like to have the following hierarchy in Doctrine2:
- Message
- SMS
- SentSMS
- ScheduledSMS
- FailedSMS
- Newsletter
- SystemComunication
But when i try to generate entities in Symfony 2 i get the following error:
[Doctrine\ORM\Mappin\MappingException]
Entity ‘Acme\HelloBundle\Entity\FailedSMS’ has a composite identifier
but uses an ID generator other than manually assigning (Identity,
Sequence). This is not supported.
I think it’s because id of FailedSMS (inherited from Message) it’s in conflict with the fact that FailedSMS itself should have an assigned id in order to CTI (with SMS) to work.
I’m asking for the moon or there is a way to make it work? A little overview of the hierarchy:
/**
* @ORM\Entity
* @ORM\Table(name="message")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="type", type="string")
* @ORM\DiscriminatorMap({"newsletter" = "Newsletter", "sms" = "SMS"})
*/
class Message {}
/**
* @ORM\Entity
* @ORM\Table(name="newsletter")
*/
class Newsletter extends Message {}
/**
* @ORM\Entity
* @ORM\Table(name="sms")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="status", type="string")
* @ORM\DiscriminatorMap({"sent"="SentSMS", "scheduled"="ScheduledSMS",
* "failed"="FailedSMS"
* })
*/
class SMS extends Message {}
/**
* @ORM\Entity
* @ORM\Table(name="failed_sms")
*/
class FailedSMS extends SMS {}
It seems to me that you don’t actually need the table “message”. If that’s the case, you should define Message as a mapped super class
Now the only CTI you need to set up is for the SMS classes.
This is not a tested reply, so I’m not sure if you’ll have issues with it or not.