I use a custom model with it's own Factory.
In my helper in the construct
public function __construct(
\Company\Module\Model\ResourceModel\Communication\CollectionFactory $communicationFactory
){
$this->_communicationFactory = $communicationFactory;
return parent::__construct($context);
}
I created the first registry and saved it with
$communication = $this->_communicationFactory->create();
And after adding some data
$communication->save();
By the time I created the first one, there was no problem, everything ok. But when I try to create another one the instance of the model has already loaded the data from the first one, and I get this error:
PHP Fatal error: Uncaught Error: Call to undefined method Company\ModuleName\Model\ResourceModel\Communication\Collection::setStatus() in /Users/Username/projects/htdocs/example.com/htdocs/extensions/company/module-modulename/Helper/Data.php:414
Anyone knows why?
helper
code for better understanding?