在自己的捆绑中扩展sylius订单模型导致无法找到" target-entity"在调整模型中

时间:2014-09-11 11:19:17

标签: php symfony sylius

我已关注http://docs.sylius.org/en/latest/bundles/general/overriding_models.html并尝试使用新字段“qrCode”扩展订单模型

实体/ Order.php

<?php

namespace Funlife\Bundle\EshopBundle\Entity;

use Sylius\Component\Order\Model\Order as BaseOrder;

class Order extends BaseOrder{
    private $qrCode;

    public function getQrCode()
    {
        return $this->qrCode;
    }

    public function setNewQrCode($qrcode)
    {
        $this->qrCode = $qrcode;
    }
}

资源/配置/教义/ Order.orm.xml

<?xml version="1.0" encoding="UTF-8"?>

<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                                      http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

    <entity name="Funlife\Bundle\EshopBundle\Entity\Order" table="sylius_order">
        <field name="qrCode" column="qrCode" type="string" length="255" nullable="false" unique="true" />
    </entity>

</doctrine-mapping>

config.yml

sylius_order:
    driver: doctrine/orm
    classes:
        order:
            model: Funlife\Bundle\EshopBundle\Entity\Order

在更新数据库时,我收到以下错误:

[Doctrine\ORM\Mapping\MappingException]                                                                                        
  The target-entity Funlife\Bundle\EshopBundle\Entity\Order cannot be found in 'Sylius\Component\Order\Model\Adjustment#order'.

有谁知道如何通过这个问题?感谢。

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题而只是运行php composer.phar update并且它有所帮助。 然后我的实体显示在地图信息