Closed thomasdom closed 7 years ago
After searching for a couple of hours, I changed a line in \<module_path>/etc/di.xml,
From this:
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="vehiclecompany_cars_car_listing_data_source" xsi:type="string">VehicleCompany\Cars\Model\ResourceModel\Car\Grid\Collection</item>
</argument>
</arguments>
</type>
To this:
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="vehiclecompany_cars_car_listing_data_source" xsi:type="string">VehicleCompany\Cars\Model\ResourceModel\Car\Collection</item>
</argument>
</arguments>
</type>
After this, the listing page loads successfully. But I have some questions:
Hi @thomasdom ,
Thanks for your feedback. It is very weird what you mention. Somehow Magento does not find your class although is there... I guess that you have already checked it but just in case. Could you check that the Folders and Files are properly written and they all start with Uppercase?
The change you did in di.xml
just demonstrates that the normal Collection
is found but unfortunately that is not a solution. Here you need to use Grid\Collection
because is the one that implements SearchResultInterface
, which is needed for Grid filters. That also answers your first question.
Regarding your second question. I do not know yet but we will try to figure it out.
I just tried to reproduce your issue using the latest version of magento2-code-generator
but it seems to work just fine. See attached video.
Could you give me more information:
var/di
and var/generation
, you still get same issue?Thanks Car EAV Module.mov.zip
Hi @jalogut,
Thank you for your help! Here are the informations you requested:
php bin/magento setup:di:compile
var/di
and var/generation
, the page appears, but the grid is replaced by this message: Class VehicleCompany\Cars\Model\ResourceModel\Car\Grid\Collection does not exist
. When I re-compile using php bin/magento setup:di:compile
, the fatal error reappears.I'm going to try to generate a CRUD EAV model in a separate generated module to check, I'll tell you if this issue still occurs.
@jalogut I solved the issue! It was a system permission issue: The directory <magento_root_dir>/app/code/VehicleCompany/Cars/Model/ResourceModel/Car/Grid
was not traversable by my Web server. That's why the exception was thrown.
So I did a find app/code/VehicleCompany/Cars -type d -exec chmod +x {} \;
and the Car listing did reappear.
Thanks a lot for your help!
Hi @thomasdom,
I am glad you found the source of the problem 😀
Regarding permissions, giving read and write access should be enough. You can find more info here:
I got this fatal error after generating a custom EAV Model :
But this class exists, and its namespace is correct (no typos).
Please, how to fix this issue ? I've been searching for several hours, but i didn't manage to find a solution.
Files :
Configuration :