0

i know so much about it

It is a singleton

It is use for injecting class and method.

So please explain me more detail.

Advance thank you for answer

2 Answers 2

0

I think this may help you in some understanding :

Helper vs Model? Which should I use?

I am quite new to Magento, but to me it looks like a Helper is Magento's equivalent of a service: "a set of related software functionalities that can be reused for different purposes". A module exports its offered functionality through services. Use a helper for the functions that you invite other modules to use.

0

The answer provided in the previous link is quite old and I don't think it's 100% true. Helper is not something against OOP at all. They are called helper but the real thing behind to be is simply to avoid code rewrite.

When you call a model, you don't need all the time all the method from that model, you don't need to load all the database etc etc. When you call an helper, you gonna write inside a peace of code that can be used everywhere without injecting data you don't need. An helper does only what he is written to do, nothing more nothing less.

Where i regroup with the answer from the previous link is that most of the time Helper are used the wrong way. How many times I see methods defined in multiples helpers; or also something akwards; helper defining collection manipulation when these methods should stay in the repositoty / collection / model part of the code.

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.