i have two modules and one gets a drop down on the admin side populated by the other values. The problem i am having is the collectionfactory is causing an error.

Warning: Declaration of vendor\modulenamesearch\Model\ResourceModel\ Grid\Collection::_construct(vendor\modulenames\Model\ResourceModel\G rid\CustomFactory $appFactory, array $data = Array) should be compatible wi th Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection:: _construct() in /var/www/vhosts/dev.vendor.com/app/code/vendor/Productapplica tionsearch/Model/ResourceModel/Grid/Collection.php on line 56


 * Grid Grid Collection.
 * @category  Vendor
 * @package   Vendor_mdoluenameearch
 * @author    Vendor
namespace Vendor\mdoluenameearch\Model\ResourceModel\Grid;

use Vendor\mdoluename\Model\ResourceModel\Grid;

class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
     * @var string
    protected $_idFieldName = 'id';

    protected $_appFactory;
     * Define resource model.
    protected function _construct(
        \Vendor\mdoluename\Model\ResourceModel\Grid\CustomFactory $appFactory,
        array $data = []

        $this->$_appFactory = $appFactory;
        return parent::__construct($data);

     public function getAllApplications()

        $total = array();
        $total[] = array('label'=>"Choose Application", 'value'=>0);
        $apps = $this->_appFactory->create();
        $Models = $apps->getCollection()->addFieldToFilter('active',1);
        foreach($Models as $Model){
            $total[] = array('label'=>$Model->getTitle(), 'value'=>$Model->getId());
        return $total;

Your Answer

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

Browse other questions tagged or ask your own question.