Fatal error: Cannot declare class Vendor\Modelname\ResourceModel\Doccount, because the name is already in use in /var/www/html/readyresale/app/code/Vendor\Modelname/Model/ResourceModel/Doccount.php on line 23

ResourceModel/Doccount.php file

namespace Vendor\Modulename\ResourceModel;

use Magento\Framework\Model\ResourceModel\Db\AbstractDb;

class Doccount extends AbstractDb
    protected function _construct()
        $this->_init ( 'documentcountable','id' );

model/Doccountmodel.php file

namespace Vendor\Modulename\Model;

use Magento\Framework\Model\AbstractModel;

class Doccountmodel extends AbstractModel
    public function _construct()
        $this->_init ( 'Vendor\Modulename\Model\ResourceModel\Doccount' );
  • can you please add code for this file? – Abhishek Panchal Jul 3 '18 at 15:03
namespace Vendor\Modulename\ResourceModel;


namespace Vendor\Modulename\model\ResourceModel;
| improve this answer | |
  • Thanks. This answer put me on the right track: My issue was that the namespace was simply wrong, i.e. I had put "Block" twice into the namespace. – Louis B. May 24 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.