0

enter code hereI have created a module for fetching data from table but when i run the module i am getting a fatal error saying cannot re-declare class. I have only one class called hello. This is my first time creating a module, i don't have experience in 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;
            }
    }
l12v6
  • 3
  • 4

1 Answers1

0

Change your class name to Helloworld. It should always match your filename.

Joe
  • 1,330
  • 13
  • 15