Hi,
I have created magento 2 module (a Magento2 Cron job, no Web stuff). Before it gets fully autogenerated, i.e. before the cron job Synchronize->execute() is even started, the whole thing runs into a problem.
The trace shows that the problem emerges preparing dependency injection for Panlab\Panstore\Model\Producer. This is my class ... that is the Panlab\Panstore things are my module.
However, it seems as though the problem pertains to internals of ObjectManager factory dynamic generation. You can see the trace here.
I am sure the problem is on my side; however, the trace gives no clues as to what I am actually doing wrong. Perhaps I maintain a class in a namespace where it shouldn't be ... Any help would be appreciated.
Thanks
I think I have found the reason for the problem: in the ./Model subsection of your module, there should be nothing else but the objects which are coupled with appropriate ResourceModel clases (model + collection folders).
If this thing is missing, you will run into the same kind of a problem as I have ... dynamic generator does not find the expected classes in ResourceModel and conveys NULL instead of definite objects in certain dependency injection procedures.
Unfortunately this did not solve the problem I still have the same error. The trace is different, but the error the same. This is the full PHP error log ... please search for "PHP Fatal error" ... any help appreciated ...
I have produced a minimal codesample for my problem. You can view it here. It is a very small Magento 2 module implementation (only a few lines). If you run it inside app/code on a fresh Mageno 2 installation, you will get this error
PHP Fatal error: Call to a member function get() on null in /var/www/jesej.si/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 126
Anyone understands why ?
P.S. Please check also the full transcript of the PHP error log after running the module.
Don't inject the OM directly
\Magento\Framework\App\ObjectManager
but instead its interface
\Magento\Framework\ObjectManagerInterface $objectmanager
.