3

I get below error when we check custom grid collection in admin. How to solve this

Recoverable Error: Argument 6 passed to Namespace\Module\Model\ResourceModel\Notification\Collection::__construct() must be an instance of Magento\Framework\Stdlib\DateTime\DateTime, null given, called in /var/www/html/magento24/app/code/Namespace/Module/Model/ResourceModel/Notification/Grid/Collection.php on line 54 and defined in /var/www/html/magento24/app/code/Namespace/Module/Model/ResourceModel/Notification/Collection.php on line 62

closed as unclear what you're asking by Manashvi Birla, 7ochem, Klettseb, Qaisar Satti, Pratik bhatt Dec 3 '15 at 12:41

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

3

If you extend from some core model, make sure to pass all required arguments to parent::__construct(), which should be called from __construct() in your class. Your class construct must accept the same list of arguments as parent, plus you can add new dependencies as follows:

Parent construct:

public function __construct(
    \Parent\Required\Dependency $parentRequiredDependency,
    \Parent\Optional\Dependency $parentOptionalDependency = null
) {
    /** Parent code goes here */
}

Child construct:

public function __construct(
    \Parent\Required\Dependency $parentRequiredDependency,
    \New\Required\Dependency $newRequiredDependency,
    \Parent\Optional\Dependency $parentOptionalDependency = null,
    \New\Optional\Dependency $newOptionalDependency = null
) {
    parent::__construct($parentRequiredDependency, $parentOptionalDependency);
    /** Custom code goes here */
}
  • this is veru useful instruction for extend core class. – Rakesh Jesadiya Dec 3 '15 at 10:12

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