首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Sonata产品列表错误(Sonata Error)

Sonata产品列表错误(Sonata Error)
EN

Stack Overflow用户
提问于 2016-10-10 17:59:50
回答 1查看 238关注 0票数 1

我在做奏鸣曲电子商务包。在成功地安装了包及其依赖项之后,我得到了管理仪表板页面。

然而,当我单击“添加新”选项的产品,我会得到一个空白块,没有字段或按钮。这是截图

但这不是它。当我单击Product的"List“选项时,会得到以下错误

代码语言:javascript
复制
An exception occurred while executing 'SELECT count(DISTINCT p0_.id) AS sclr_0 FROM product__product p0_ LEFT JOIN product__product_category p1_ ON p0_.id = p1_.product_id LEFT JOIN classification__category c2_ ON p1_.category_id = c2_.id LEFT JOIN product__product_collection p3_ ON p0_.id = p3_.product_id LEFT JOIN classification__collection c4_ ON p3_.collection_id = c4_.id WHERE p0_.product_type IN ()':

SQLSTATE42000:语法错误或访问冲突: 1064您的SQL语法出现了错误;请检查与MySQL服务器版本对应的手册,以获得在第1行使用的正确语法

在浏览互联网时,我在github上发现了一个同样的问题(https://github.com/sonata-project/ecommerce/issues/9)。我遵循了建议的解决办法.

  • 使用php app/console sonata:product:generate Bowl sonata.ecommerce_demo.product.bowl创建产品类型(Bowl)
  • 导入资源
  • 创建app/config/sonata/sonata_product.yml,如文档所示
  • 最后使Bowl类继承了Product

但我还是犯了同样的错误。

这是我的Bowl.php

代码语言:javascript
复制
<?php

/*
 * This file is part of the <name> project.
 *
 * (c) <yourname> <youremail>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Application\Sonata\ProductBundle\Entity;

//use Sonata\ProductBundle\Entity\Product as Product;

/**
 * This file has been generated by the Sonata product generation command ( https://sonata-project.org/ )
 *
 * References :
 *   working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
 *
 * @author <yourname> <youremail>
 */
class Bowl extends Product {

    /**
     * @var integer $id
     */
    protected $id;

    /**
     * Get id
     *
     * @return integer $id
     */
    public function getId() {
        return $this->id;
    }

    /**
     * @param int $id
     */
    public function setId($id) {
        $this->id = $id;
    }

}

有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2016-10-11 13:16:11

弄明白了:

创建产品类型(http://sonata-project.org/bundles/ecommerce/master/doc/reference/tutorials/create-product.html) php应用程序/控制台奏鸣曲:产品:generate sonata.ecommerce_demo.product.bowl

导入所有资源

完成此操作后,编辑src/Application/Sonata/ProductBundle/Entity/Bowl.php使其继承Product。

类Bowl扩展积{

}

注意:不要忘记导入sonata_product.yml(文档中没有提到这一点)。添加-{ config.yml的资源: sonata/sonata_product.yml }

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39964110

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档