0

I am using plugin to load the customer collection in admin panel,this is i have done..

di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/
config.xsd">


    <type name="Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider">
        <plugin name="productdata" type="Learning\HelloPage\Plugin\ProductDataProvider" />
    </type>
</config>

Here is my plugin file Plugin/CustomerDataProvider.php

<?php

namespace Learning\HelloPage\Plugin;

class CustomerDataProvider
{
       public function aroundGetData(
        \Magento\Customer\Ui\Component\DataProvider $subject,
        \Closure $proceed
    ) 
    {   

        //what to do here??

    }


}

as customer page keeps loading all the time.. here is a screenshot..

enter image description here

0

Please read this article - http://devdocs.magento.com/guides/v2.1/extension-dev-guide/plugins.html

Your mistake in this case that you forgot to call callable function.

<?php

namespace Learning\HelloPage\Plugin;

class CustomerDataProvider
{
       public function aroundGetData(
        \Magento\Customer\Ui\Component\DataProvider $subject,
        \Closure $proceed
    ) 
    {   

        $proceed();

    }


}
| improve this answer | |
  • Fatal error: Method Magento\Ui\TemplateEngine\Xhtml\Result::__toString() must not throw an exception, caught Error: Call to a member function setPageSize() on null in /var/www/html/magento2/vendor/magento/module-ui/Component/Wrapper/UiComponent.php on line 0 – Jay Kapoor Sep 12 '17 at 5:49
  • got this if i use proceed(); – Jay Kapoor Sep 12 '17 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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