I am creating this ManyToMany relationship between my two objects in Symfony2 and want the link table to have charset latin1 and engine MyISAM (by default they are UTF-8 and InnoDB).
Here they are:
Entity \ Commande
<?php // ... /** * Commande * * @ORM\Table(name="commande", options={"collate"="latin1_general_ci", "charset"="latin1", "engine":"MyISAM"}) * @ORM\Entity() */ class Commande { // ... /** * @var ArrayCollection * * @ORM\ManyToMany(targetEntity="Paiement", inversedBy="commandes", cascade={"persist"}) * @ORM\JoinTable(name="paiement_commande", * joinColumns={@ORM\JoinColumn(name="commande_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="paiement_id", referencedColumnName="id")} * ) */ private $paiements;
Entity \ Paiement
<?php // ... /** * Paiement * * @ORM\Table(name="paiement", options={"collate"="latin1_general_ci", "charset"="latin1", "engine":"MyISAM"}) * @ORM\Entity() */ class Paiement { // ... /** * @var ArrayCollection * * @ORM\ManyToMany(targetEntity="Commande", mappedBy="paiements", cascade={"persist"}) * @ORM\JoinTable(name="paiement_commande") */ private $commandes;
As you can see, I know how to correctly set this information for entity tables, but how to do this for the paiement_commande table?
I tried:
/* * @ORM\JoinTable(name="paiement_commande", options={"collate"="latin1_general_ci", "charset"="latin1", "engine":"MyISAM"}) */ private $commandes;
But I got the command $ php app/console doctrine:schema:validate :
[Doctrine\Common\Annotations\AnnotationException] [Creation Error] The annotation @ORM\JoinTable declared on property Entity\Paiement::$commandes does not have a property named "options". Available properties: name, schema, joinColumns, inverseJoinColumns
How can I establish this ManyToMany relationship between my two objects and still be able to specify both engine and charset for the newly created link table?
Thanks for the help!