我在做奏鸣曲电子商务包。在成功地安装了包及其依赖项之后,我得到了管理仪表板页面。
然而,当我单击“添加新”选项的产品,我会得到一个空白块,没有字段或按钮。这是截图

但这不是它。当我单击Product的"List“选项时,会得到以下错误
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.php
<?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;
}
}有什么想法吗?
发布于 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 }
https://stackoverflow.com/questions/39964110
复制相似问题