doctrine Discriminator Column更新

时间:2016-09-15 07:45:52

标签: php doctrine-orm symfony query-cache

我在更新DiscriminatorColumn名称

时遇到问题

实体:

/**
 *@ORM\Entity
 *@ORM\Table(name="item")
 *@ORM\InheritanceType("JOINED")
 *@ORM\DiscriminatorColumn(name="item_type", type="string")
 */
abstract class Item
{

}


/**
 *@ORM\Entity
 *@ORM\Table(name="product")
 *@ORM\InheritanceType("JOINED")
 */
abstract class Product extends Item
{

}

/**
 *@ORM\Entity
 *@ORM\Table(name="vehicle")
 *@ORM\InheritanceType("JOINED")
 */
abstract class Vehicle extends ItemBundle\Product
{

}


/**
 *@ORM\Entity(repositoryClass="Aussiito\Bundles\VehicleBundle\Entity\Repository\CarRepository")
 *@ORM\Table(name="car")
 */
class Car extends Vehicle
{
}


class CarRepository extends EntityRepository
{

    public function getListCars(){
        return $this->findAll();

    }
}

在我没有添加注释之前:@ORM \ DiscriminatorColumn(name =" item_type",type =" string")on" Item" ,所以默认我有列dType。我想用"重命名这些字段。 item_type"所以我添加了注释并执行以下命令:

php bin/console doctrine:schema:update

数据库的修改已成功执行但当我调用函数getListCars()时,出现以下错误:

执行' SELECT t3.id AS id_4时发生异常,t3.created_at AS created_at_5,t3.updated_at AS updated_at_6,t2.id AS id_7,t1.id AS id_8,t0.id AS id_9,t3 .dtype FROM car t0 INNER JOIN vehicle t1 ON t0.id = t1.id INNER JOIN product t2 ON t0.id = t2.id INNER JOIN item t3 ON t0.id = t3.id':

SQLSTATE [42S22]:未找到列:1054未知列&t 39.dtype'在'字段列表'

所以我认为这是缓存,我执行了以下命令:

php bin/console cache:clear --env=prod
php bin/console cache:clear --env=dev
php bin/console doctrine:cache:clear-query  
php bin/console doctrine:cache:clear-result  
php bin/console doctrine:cache:clear-metadata 

但我有同样的错误。

任何人都有解决方案吗?

0 个答案:

没有答案