Closed midlan closed 4 years ago
If I have some model that needs parameters:
<?php class Vendor_Module_Model_Example extends Mage_Core_Model_Abstract { protected $_myDep; public function __construct(array $dependencies) { parent::__construct(); if (isset($dependencies['mydep']) && ($attributes['mydep'] instanceof MyDep)) { $this->_myDep = $attributes['mydep']; } else { throw new ArgumentCountError('Too few arguments to function ' . __FUNCTION__); } } .... } //using model: Mage::getModel('vendor_module/example', array('mydep' => new MyDep));
Then calling $model = new $className; in adminmonitoring on line
$model = new $className;
src/app/code/community/FireGento/AdminMonitoring/Model/History/Data.php:65
throws exception. My fix clones the object, so dependencies are kept and there is no need to call constructor. Clears data by setting empty array before load.
If I have some model that needs parameters:
Then calling
$model = new $className;
in adminmonitoring on linethrows exception. My fix clones the object, so dependencies are kept and there is no need to call constructor. Clears data by setting empty array before load.