Best practice for organising reusable DBAL queries in Symfony2?

后端 未结 2 1490
萌比男神i
萌比男神i 2021-02-03 12:56

I\'m working on a Symfony2 project at the moment. For the most part it\'s totally standard; I\'m using the ORM layer to interface with the database via my Entities. No problems

2条回答
  •  梦毁少年i
    2021-02-03 13:30

    Wow, your answer implies that you have all your queries at the same places for every table.

    I don't like this wrapper thing, I prefere having services. One service per table or per bundle, it depends if you have lot of tables and how you'd like to have your queries organized.

    Then I pass the desired connection as a service's arguments and that's all.

提交回复
热议问题