-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using extended classes in project #914
Comments
Is it possible to provide more related articles, docs, etc. covering your mind map about planned "Service extension-ability"? I have found articles and docs only about entity related extensions, I am not sure if it is same Provided examples are too simple from my point of view and therefore little bit misleading for example I want to use some third party "module" (or package), which also extends
if it is only about IDE support and autocomplete; I would suggest to have a look at |
This issue has been automatically marked as stale because there was no activity within the last 4 months (and it is quite a long time). It will be closed if no further activity occurs. Thank you for your contributions. |
up |
Hi, @simara-svatopluk is already analyzing possible solutions for this 😉 |
What is happening
Model situation:
In my project, I extend
ArticleFacade
, add there newpublic myNewFunction()
, and configure my new service as an alias for the original one inservices.yml
, something like this:Then, I want to use
ArticleFacade::myNewFunction()
inController\Front\ArticleController
that has a dependency onArticleFacade
from the core (ie.FrameworkBundle
).At the moment, I am able to use the new function thanks to the DI container configuration, however, the IDE is not aware of it as the dependency is still typehinted and annotated as the original
ArticleFacade
from the core, and therefore I am not able to click on the functionmyNewFunction
and navigate to the proper class. This might be very confusing from a long-term maintainability point of view.Possible solutions
ArticleFacade
(ie. the descendant implemented by me inShopBundle
) indeed:Personally, I prefer the solution 2. I am thinking about implementation of some fixer, that would automatically change all the dependencies in
project-base
in such a case, maybe it could add the entry toservices.yml
as well. Basically, if you extended a class, the fixer would ensure that it is used everywhere in your project instead of the parent class.More on that, we should cover the situation when I extend some class that is dependent on a class that I have already extended:
ShopBundle\ArticleFacade
extendsFrameworkBundle\ArticleFacade
FrameworkBundle\Admin\ArticleController
is dependent onFrameworkBundle\ArticleFacade
- everything ok so farShopBundle\Admin\ArticleController
extendsFrameworkBundle\Admin\ArticleController
- now I should probably ovewrite the dependency onFrameworkBundle\ArticleFacade
and start using myShopBundle\ArticleFacade
I would like to validate the fixer idea so I am asking here for your opinions or other suggestions.
Expected result
There is a consensus on the proper usage of extended classes in project.
The text was updated successfully, but these errors were encountered: