How to set up entity (doctrine) for database view in Symfony 2

前端 未结 6 1375
心在旅途
心在旅途 2020-11-30 01:51

Lets say i have a view table. And i want to get data from it to an entity. Can i (and how) create entity class to do that. (no save operation needed). I just want to display

6条回答
  •  我在风中等你
    2020-11-30 02:34

    There is nothing special in querying a view — it's just a virtual table. Set the table of your entity this way and enjoy:

    /**
     * @ORM\Entity
     * @ORM\Table(name="your_view_table")
     */
    class YourEntity {
        // ...
    }
    

提交回复
热议问题