压倒一切的秩序类sylius抛出异常“sylius_order”已存在

问题描述 投票:0回答:2

我想添加一个新的领域,以顺序表。但首要的是抛出错误,如表已经存在。我试图按照qazxsw POI问题。但没有运气。

我的实体

https://github.com/Sylius/Sylius/issues/3997

配置文件:

   <?php

namespace Goldco\Entity;

use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Order\Model\Order as BaseOrder;//Sylius\Component\Core\Model\Order as BaseOrder;
use Sylius\Component\Order\Model\OrderItemUnitInterface;

/**
 * Order
 *
 * @ORM\Table(name="sylius_order")
 * @ORM\Entity
 */
class Order extends BaseOrder
{


    /**
     * @var string|null
     *
     * @ORM\Column(name="quantity_decimal", type="decimal", precision=12, scale=4, nullable=true, options={"comment"="decimal quantity"})
     */
    private $quantityDecimal;



}

和orm.yml

sylius_order:
    resources:
        order_item:
            classes:
                model: Goldco\Entity\SyliusOrderItem
                controller : Goldco\Controller\App\OrderItemController
        order:
            classes:
                model: Goldco\Entity\Order
                controller: Sylius\Bundle\CoreBundle\Controller\OrderController
                repository: Sylius\Bundle\CoreBundle\Doctrine\ORM\OrderRepository

在执行命令的ORM我收到错误,如:

Goldco\Entity\Order:
    type: entity
    table: sylius_order
    fields:
        quantityDecimal:
            type: decimal
            nullable: true
            precision: 12
            scale: 4
            options:
                comment: 'decimal quantity'
            column: quantity_decimal
    lifecycleCallbacks: {  }

遗漏在这里配置?

编辑:

 The table with name 'eco_latest.sylius_order' already exists.

$this->addSql('CREATE TABLE SyliusOrder (id INT AUTO_INCREMENT NOT NULL, number VARCHAR(255) DEFAULT NULL, notes LONGTEXT DEFAULT NULL, state VARCHAR(255) NOT NULL, checkout_completed_at DATETIME DEFAULT NULL, items_total INT NOT NULL, adjustments_total INT NOT NULL, total INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, currency_code VARCHAR(3) NOT NULL, locale_code VARCHAR(255) NOT NULL, checkout_state VARCHAR(255) NOT NULL, payment_state VARCHAR(255) NOT NULL, shipping_state VARCHAR(255) NOT NULL, token_value VARCHAR(255) DEFAULT NULL, customer_ip VARCHAR(255) DEFAULT NULL, invoice_no VARCHAR(100) DEFAULT NULL, invoice_file_path VARCHAR(100) DEFAULT NULL, UNIQUE INDEX UNIQ_3458A6D996901F54 (number), PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB'); 表在我的数据库中创建。我不知道任何设置是否需要做修复。

symfony sylius
2个回答
1
投票

定制类必须映射超。使用下面的注释:

syliusorder

0
投票

在orm.yml,类型从/** * @ORM\MappedSuperclass * @ORM\Table(name="sylius_order") * @ORM\Entity */ 改为entity

mappedSuperclass

© www.soinside.com 2019 - 2024. All rights reserved.