M
M
Michael2017-06-15 18:06:14
PHP
Michael, 2017-06-15 18:06:14

How to call extended classes?

To work with the Magento 2 API, I made (generated) myself a lib https://github.com/springimport/swagger-magento2-client The project itself is on yii2.
There was a need to extend the basic methods. Naturally, I don't want to touch the code, so I started the extension in a "new layer" - separate classes inherited from the base ones in the lib. In the project, now some of the code uses base classes, and some uses extended ones. Decided it was time to use DI. In this case, the project will only depend on the interface. By default, there are no interfaces in the lib and, probably, you will have to generate them manually and assign them to each class. But I don't see any other solution.
Does such an extension satisfy the principles of SOLID and adequacy?
And if you need to do caching of methods, then I prescribe a caching class for the interface and that's it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fortop, 2017-06-16
@Fortop

You can define for yourself that the base classes of the library act as interfaces for you, that is, do not use them directly anywhere.
In this case, you do not need to generate and prescribe anything manually.
As for the issue of evaluation by SOLID, what does it have to do with it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question