【发布时间】:2017-11-01 15:36:58
【问题描述】:
enter code here我创建了一个用于从表中获取数据的模块,但是当我运行该模块时,我收到了一个致命错误,提示 无法重新声明类。我只有一门课叫你好。这是我第一次创建模块,我没有magento 1的经验Link for module source code github
Block\Helloworld.php
<?php
namespace Devchannel\Helloworld\Block;
use Magento\Framework\View\Element\Template\Context;
use Devchannel\Helloworld\Model\Data;
use Magento\Framework\View\Element\Template;
class Hello extends Template
{
public function __construct(Context $context, Data $model)
{
$this->model = $model;
parent::__construct($context);
}
public function sayHello()
{
return __('Hello World');
}
public function getHelloCollection()
{
$helloCollection = $this->model->getCollection();
return $helloCollection;
}
}
【问题讨论】:
标签: php magento magento2 magento2.1