Note that there are some explanatory texts on larger screens.

plurals
  1. POSymfony2 / Doctrine - Joining Mysql and Sqlite Entities
    text
    copied!<p>I'm having a problem with Symfony2 / Doctrine.</p> <p>I'm starting to think that I'm trying to do the impossible, joining 2 seperate databases together via a relationship.</p> <ul> <li>I've got a mysql database, and an sqlite database. </li> <li>I've got 2 bundles (each talking to one of the databases each)</li> <li>I've got 2x Entity Managers, with mappings working correctly.</li> </ul> <p>I can access each database, via it's own Entity Manager just fine, Each bundle can access the other bundles Entity Manager, and it's all working well on that front.</p> <p>The Sqlite database is locked-down to another application, and I have to use it as-is. The mysql-database is mine to do whatever I need with.</p> <ul> <li>In the sqlite database I've got a "Projects" table</li> <li>In the mysql database I've got a "Tasks" table.</li> <li>One project can have many tasks.</li> </ul> <p>My tasks table has a project_id field, which is populated with the ID from the projects table. What I'm trying to do is to make this relationship work properly, so that I can use twig to do what you normally can do with twig in more normal situations. I.e. call something like <strong>{{ project.tasks }}</strong> or <strong>{{ tasks.projects }}</strong>. </p> <p>At the moment I've got some code in the Project controller, passing the Tasks to the views and vice versa. This does work, but it's quite cumbersome. What I'd really like to do is to have the ORM mapping working correctly between each entity.</p> <p><strong>Can Doctrine/Symfony2 do this, or am I trying to do the impossible?</strong></p> <p>Any assistance would be greatly appreciated.</p> <p>Here's an extract from my config.yml file.</p> <pre><code>orm: auto_generate_proxy_classes: %kernel.debug% default_entity_manager: agile entity_managers: glue: connection: glue mappings: WebplaceGlueBundle: ~ agile: connection: agile mappings: WebplaceAgileBundle: ~ </code></pre>
 

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