I have a bunch of models setup in Doctrine, where some of the models are in different databases. Doctrine's schema generation tool seems to be generating inter-database foreign keys, but not cross-database foreign keys.
For example:
/** * @ORM\Entity * @ORM\Table(name="db1.Contact") **/ class Contact { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue **/ private $id; } /** * @ORM\Entity * @ORM\Table(name="db2.Subscription") **/ class Subscription { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue **/ private $id; /** * @ORM\ManyToOne(targetEntity="Contact") * @ORM\JoinColumn(name="contact_id", referencedColumnName="id") */ private $contact; } Critically, hydrating these entities works totally fine, but the schema tool simply doesn't generate the foreign keys.
Has anyone ran into this before? There is another SO post however it is unfortunately unanswered.