I'm new Symfony2 user and I need help! I have two Bundles with entities:
// My\FooBundle\Entity\Foo.php
namespace My\FooBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="foo")
* @ORM\Entity
*/
class Foo
{
/*...*/
/**
* @ORM\OneToOne(targetEntity="My\BarBundle\Entity\Bar")
*/
private $bar;
}
And in another bundle:
// My\BarBundle\Entity\Bar.php
namespace My\BarBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="bar")
* @ORM\Entity
*/
class Bar
{
/*...*/
/**
* @ORM\Column(name="name", nullable=false)
*/
private $name;
}
And my config.yml:
doctrine:
dbal:
default_connection: foo
connections:
foo:
dbname: "foo"
bar:
dbname: "bar"
orm:
entity_managers:
foo:
connection: foo
mappings:
MyFooBundle: ~
MyBarBundle: ~
bar:
connection: bar
mappings:
MyBarBundle: ~
And SF creates Bar in Foo database. Q: How do I create a relation between two connections in this situation?