I have a preference in di.xml:

    <?xml version="1.0"?>
        <preference for="Magento\CatalogRule\Api\Data\RuleInterface" type="Module\Vendor\Model\RuleInterface" />

I want add methods to an interface, but when I access to interface with postman, Magento have the error PHP Fatal error: Uncaught Error: Cannot instantiate interface.



  • please clear the var folder and then running setup:upgrade. If this doesn't solve it then look for errors in di.xml files – Abhishek Panchal Dec 4 '17 at 17:24
  • I run the commands but not work, and execute setup:di:compile but nothing – AndresF Dec 5 '17 at 10:36
  • I think you're not supposed to put a interface class in Model when building apis – Pathfinder Dec 28 '18 at 1:33

Your Answer

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

Browse other questions tagged or ask your own question.