I need to override the UpgradeData Class from Catalog\Setup\UpgradeData But the constructor has factories in his arguments like CategorySetupFactory

When I run setup:di:compile I got an error that this class does not exists. How can I then override that class or one of its functions at least?

  • 1
    I'm curious about the reason why you want to override the upgrade data class? – Khoa TruongDinh Apr 13 '17 at 15:02
  • I have the problem that the new update to 2.1.6 cant use setup:upgrade because there is a problem with attribute_id. There is also a fix for this class but I cant override it. – Timo.Klement Apr 14 '17 at 6:28

Factory classes have only 1 function, namely create and its only purpose is to return a new instance of a class they are factory of, so Magento\Catalog\Model\CategorySetupFactory will return an instance of Magento\Catalog\Model\CategorySetup. If you require some specific changes to that class create a preference for that class.

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.