How to add indexes in an extended entity with Doctrine2?

742 Views Asked by At

I'm using Doctrine2 to extend an Entity. The main entity is so defined:

    /**
 * 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

While the extended entity starts like this

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

Now I want to add another index to the resulting table "erp_articoli" but I can't figure out how to do that. The tag @ORM\Table(indexes={@Index(name="search_codfamweb", columns={"codice_famiglia_web"})}) won't do anything (not even errors)...How to achieve my goal?

0

There are 0 best solutions below