AliHichem / AliDatatableBundle

Symfony2 Ajax Datagrid Bundle for doctrine2 entities
MIT License
112 stars 71 forks source link

Set EntityManager #107

Closed rufinus closed 9 years ago

rufinus commented 9 years ago

I have a project which needs to use two different databases, via different connections. so i have to set the entitymanager for some of the datatables.

I currently extend your class and added an setEm() method, but this should be supported by default.

Of course this is not enough, your QueryBuilder doesnt get the EntityManger from its parent object, but again from the container.

Why do you even set $this->_em ?

AliHichem commented 9 years ago

Why do you even set $this->_em ? if you're talking about L74 in Datatable.php, I'm not sure why I have that maybe it was used before and after some refactoring it become useless. Anyway, I definitely need to remove that .

About you issue, I agree having a clean way to set the entity manager in datatable would be helpful. Any suggestion about where you wanna set it ? I'm thinking about two places :

I'm open to suggestions.

AliHichem commented 9 years ago

Update is added in the commit 166d4cd937da47da05045efdb360f07eb87fb4e0. No "fix issue" message since this is a feature.