Is there any disadvantage ior is it discouraged to use proxy on factory class? I am extending from some Customer\Address controller and it has some dependencies which I won't use. I want to replace by proxy \Magento\Customer\Model\Metadata\FormFactory.

1 Answer 1


I also asked myself this question. Didn't find the proper answer but, I made several conclusions:

  • No need to create Proxy for Factory because the factory is not heavy enough. If you would look at any Factory class - you will see, that only object manager passed to the constructor (I don't take into account string with instance name). You can also take a look at the proxy class and ensure there is also only object manager in the constructor. So this to classes is approximately equal by the heaviness. Conclusion - no reason to replace Factory with Factory\Proxy
  • Magento doesn't proxied Factory. If you would search in Magento core code you'll find that Magento core team doesn't proxied Factory at all. The only place where I was able to find this in Magento\Framework\View\Element\UiComponent\Factory\HtmlContentFactory\Proxy and honestly I have no idea why...

After this two conclusions, I didn't use the proxy for Factories.

I know it's a little bit late for the answer, but maybe someone else will find this helpful.

  • I think it makes sense, especially first argument. Commented Mar 22, 2018 at 10:49

Your Answer

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

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