我正在使用Doctrine2扩展实体。 主要实体是这样定义的:
/**
* ERP_Articoli
* @ORM\Table(name="erp_articoli", indexes={
* @Index(name="search_company", columns={"company"}),
* @Index(name="search_codfam", columns={"codice_famiglia"}),
* @Index(name="search_codgrumer", columns={"codice_gruppo_merceologico"}),
* @Index(name="search_tipologia", columns={"tipologia"}),
* @Index(name="search_flagpuweb", columns={"flag_pubblica_web"}),
* })
* @Gedmo\SoftDeleteable(fieldName="deletedAt")
* @ORM\Entity(repositoryClass="MyCompanyBundle\Repository\ERP_ArticoliRepository")
* @CompanyAware(companyFieldName="company")
*
* @ORM\InheritanceType("SINGLE_TABLE")
*
*/
class ERP_Articoli
虽然扩展实体是这样开始的
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\Index;
use MyCompanyBundle\Entity\ERP_Articoli as BaseErpArticoli;
/**
* ERP_Articoli
*
* @ORM\Entity(repositoryClass="MyCompanyExtendedBundle\Repository\ERP_ArticoliExtendedRepository")
* @ORM\Table(indexes={@Index(name="search_codfamweb", columns={"codice_famiglia_web"})})
*/
class ERP_ArticoliExtended extends BaseErpArticoli
现在,我想向结果表“ erp_articoli”中添加另一个索引,但是我不知道该怎么做。标签@ORM\Table(indexes={@Index(name="search_codfamweb", columns={"codice_famiglia_web"})})
不会做任何事情(甚至不会出错)...如何实现我的目标?