i have a general question.
Let’s assume a Mapper class in my business model. Somewhere in the class i have to get a new Transfer. The classic way you would do is “new XyzTransfer()”. I can see this everywhere in the core code.
But everywhere else in Spryker the factory is used to instantiate new objects.
So, what is the best way for that as long as there is no possible $this->getFactory() call available in the Model?
I can think of two ways
Inject the factory to business model?
Stay with “new” keyword in business models
First seems dirty and is maybe violating the SRP.
Second seems not flexible enough to test.
Any other ideas?
What is your recommendation and why?