Is it possible to generate a view from database with Doctrine 2?
I explain:
My db contains some views I want use, but I don't know how generate these views.
In my case, I have two tables and one view, the view selects a few columns in each table and I just want THIS view in the folder "Entity" of the project.
Database views are
notcurrently supported by Doctrine 2, but it can potentially perform very badly. Try it yourself mapping the view as an entity and mark it as a @readOnly entity.For people who are interested by the answer :
I based my answer on this : How to set up entity (doctrine) for database view in Symfony 2
For example , if you have a view "A" with column "Id" and "Name" :
At src/Name/YourBundle/Resources/config/doctrine, create "A.orm.yml" with attributs like :
After that, create your A.php in Name/YourBundle/Entity/A :
And ... you can call your view with your controller.