Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to setup Symfony2 Bundles independently with related Entities
    text
    copied!<p>I am trying to figure out a smart way to implement my bundles with following requirements:</p> <ol> <li>I have a Bundle with logic named <code>LogicABundle</code></li> <li>I have a Bundle with common things as design and Menus called <code>AppBundle</code></li> <li>I have another Bundle with logic <code>LogicBBundle</code> with some entities related to <code>LogicABundle</code> entities</li> </ol> <p>I know want to be able to "deploy" two applications from this setup:</p> <ol> <li>Application one uses the <code>LogicABundle</code> and <code>AppBundle</code></li> <li>The second one uses <code>LogicABundle</code>, <code>LogicBBundle</code> and <code>AppBundle</code></li> </ol> <p>The issue is, that for the second application I need to relate some Entities from <code>LogicABundle</code> to <code>LogicBBundle</code>, which causes the first "deploy" option to brake, if I just have an entity in <code>LogicABundle</code> pointing to <code>LogicBBundle</code>.</p> <p>Is there a smart solution to deploy these two different applications independently? Here is an example in order to make it easier to understand: namespace My\LogicABundle\Entity\Game;</p> <pre><code>use Doctrine\ORM\Mapping as ORM; /** * My\LogicABundle\Entity\Game * * @ORM\Entity * */ class Game { /** * @var integer $id * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string $title * * @ORM\Column(name="title", type="string") */ private $title; /** * * @var Message * @ORM\ManyToOne(targetEntity="\My\LogicBBundle\Entity\Message", inversedBy="games") * @ORM\JoinColumn(name="messag_id", referencedColumnName="id", nullable=false) * @Assert\NotNull() */ private $message; } </code></pre> <p>I want to be able to use the Game class in my standalone application only with LogicABundle, and in my second application I need the game Entity with message relation.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload