Doctrine 2 with multiple indexes

后端 未结 2 878
旧巷少年郎
旧巷少年郎 2021-02-02 10:07

I am developing using zend framework and doctrine2.1.

I have generated entities from database.

But the problem is: Doctrine doesn\'t recognize my indexes. They

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-02 10:35

    Here is an example:

    /**
     * @Entity
     * @Table(name="serial_number",indexes={
     *  @index(name="product_idx", columns={"product_id"}),
     * })
     */
    class SerialNumber { // Entity Class
    
        /**
         * @var int
         * 
         * @Id
         * @GeneratedValue
         * @Column(type="integer")
         */
    
        protected $id;
    
        /**
         * @Column(name="created_at", type="datetime")
         * @var \DateTime
         * */
        protected $created;
    
        /**
         * @Column(name="updated_at", type="datetime")
         * @var \DateTime
         * */
        protected $updated;
    
        /**
         * @Column(name="product_id", type="integer")
         */
        protected $productID;
    
    }
    

提交回复
热议问题