Symfony2 MVC: where does my code belong?

前端 未结 3 377
独厮守ぢ
独厮守ぢ 2020-12-09 06:18

I\'m seeking clarification on whether to put code in a controller, an entity or to make a service.

I have \'cardset\' and \'card\' objects (where many of the latter

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-09 07:17

    If you will follow SOLID principles you will get to the SRP which states that your class should have one single responsibility.

    I think it is obvious that generating one pdf is something diferent than modeling data and mapping your database( your entity does that)

提交回复
热议问题