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? Jul 3, 2018 at 15:03

1 Answer 1



namespace Vendor\Modulename\ResourceModel;


namespace Vendor\Modulename\Model\ResourceModel;
  • 2
    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, 2020 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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