1

I have developed a extension for Magento 2. I have doen all my development work in version 2.0.5. After completion of the development work, I tried to test it on Magento 2.1. But now I am facing problems.

On Magento 2.0 extension installed successfully and works great. But when I try to install it on Magento 2.1 then I receive the following error:

Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory. current version - none, required version - 1.0.0

After this I have manually added 1.0.0 in data_version column of setup_module table.

Now after that admin panel works and I have tried to access my module then I got below error:

Class PageGridDataProvider does not exist

I am using this class in below code as per tutorial of Custom module in Magento 2.0

<dataSource name="grid_record_grid_list_data_source">
    <argument name="dataProvider" xsi:type="configurableObject">
        <argument name="class" xsi:type="string">PageGridDataProvider</argument>
        <!-- here we pass dataprovider name which i will define in di.xml file of module in next step -->
        <argument name="name" xsi:type="string">grid_record_grid_list_data_source</argument>
        <argument name="primaryFieldName" xsi:type="string">id</argument>
        <argument name="requestFieldName" xsi:type="string">id</argument>
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="update_url" xsi:type="url" path="mui/index/render"/>
            </item>
        </argument>
    </argument>
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
        </item>
    </argument>
</dataSource>

I am stuck at this error. Can anybody help me please. Is magento 2.1 require different extension development process?

Thanks

EDIT:

I have added below code in di.xml and now Class PageGridDataProvider does not exist error gone.

<virtualType name="PageGridDataProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider"/>

Now can you help me out to solve the first issue. In which the data-version is not inserting during Installation and below error occours:

Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory. current version - none, required version - 1.0.0

4
  • Can you show your di.xml?
    – Sohel Rana
    Nov 23, 2016 at 7:34
  • 1
    have you seen this magento.stackexchange.com/questions/98892/… ? Nov 23, 2016 at 7:41
  • 1
    @chirag Thanks a lot mate. This answer helps me. Below code added in di.xml Now extension working in M 2.1 <virtualType name="PageGridDataProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider"/> Nov 23, 2016 at 8:54
  • i have posted this as answer feel free to accept. if this has solve your concern. Nov 23, 2016 at 10:51

3 Answers 3

1

You have to use this di.xml file.

The PageGridDataProvider resolves to a virtualType

<virtualType name="PageGridDataProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider">
...
</virtualType>

You can also refer Magento 2: Why does a UI Listing Component need Two Collections?

It will help you.

1

I think that you should declare your PageGridDataProvider class in di.xml as virtual type as follow:

di.xml

<virtualType name="PageGridDataProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider">
    <arguments>
        <argument name="collection" xsi:type="object" shared="false">Vendor\Modulename\Model\ResourceModel\PageGrid\Collection</argument>
    </arguments>
</virtualType>

Then you should create your collection resource model for filling that data provider

Vendor\Modulename\Model\ResourceModel\PageGrid\Collection

Edit: did you try to delete var/generation folder and flush caches?

2
  • Below code added in di.xml and works. Thanks for your help mate. <virtualType name="PageGridDataProvider" type="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider"/> Nov 23, 2016 at 8:56
  • upvote if it's working. Run php bin/magento setup:upgrade and you will update version of the module and run the install/upgrade scripts for your module Nov 23, 2016 at 9:47
0

Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory. current version - none, required version - 1.0.0

Hi Dheeraj,

Please run following command on cmd to solve this issue.

Step : 1 Access the bin folder of your project on cmd Exp : -D:\server\htdocs\projectname\bin

Step 2:- Access the php.exe of your localserver Exp : - D:\server\php\php.exe

Step 3:- And run the fbelow command on your cmd console

Exp :- D:\server\htdocs\projectname\bin> D:\server\php\php.exe magento setup:upgrade

If you facing in issue then ask me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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