0

I've just started a new Symfony (2.8) project which is a CRM to integrate with an existing OpenCart site. The database is already set up, the only CRM specific tables are the user table for CRM users and projects that are not related to OpenCart.

I have created entities for the user and projects tables, but I need to be able to reference the OpenCart tables too, specifically products, customers and orders. Is it possible to access these without having to create Doctrine entities for them first? I'd rather use Doctrine queries over full SQL but I am not sure if I need to generate entities for all of the OpenCart tables first.

Any help appreciated!

Thank you

1 Answer 1

1

Previous answer (misunderstood): Yes, it is possible. You need to define your OpenCart database as a new Connection in your application.

Check this documentation: http://symfony.com/doc/current/cookbook/doctrine/multiple_entity_managers.html

Then, when you can request your entities through two EntityManagers: "default" and "opencart".

EDIT : In my opinion, yes, defining entities for your Opencart data is the best choice, since as far as I know it is mandatory for using DQL.

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks but I'm only using the one database - my additional tables are within the existing OpenCart database, so it isn't two different connections - also I'd rather keep all my code in the one bundle and not separate them. I can't really reference non-existing repositories though so I'm wondering if it is possible to do it the way I want...
Oh sorry, thought you had 2 databases. So, in my opinion, yes, defining entities for your Opencart data is the best choice, and as far as I know it is mandatory for using DQL.
is 'defining entities' an opencart or an ORM/doctrine property/behavior?
@Scott a Doctrine behaviour. What I meant was registering the entities (whether it is through PHP annotations, YAML, XML, etc.)
yeah i caught up with that when reading more on the other comments and threads

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.