Doctrine 2 with multiple indexes
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;
}
I would say you can insert multiple indexes in the indexes property (but I haven't had the time to test it):
indexes={
@ORM\Index(name="index_name", columns={"database_column1","database_column2"}),
@ORM\Index(name="index_name2", columns={"database_column1"}),
@ORM\Index(name="index_name3", columns={"database_column2"})
}
Hope this helps you