Skip to content
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

Explain how to use Symfony service overrides and decorations #334

Merged
merged 2 commits into from Sep 12, 2019

Conversation

@matks
Copy link
Contributor

commented Sep 4, 2019

No description provided.

@jf-viguier

This comment has been minimized.

Copy link
Contributor

commented Sep 4, 2019

Thanks a lot for that usefull doc @matks

@kpodemski

This comment has been minimized.

Copy link
Contributor

commented Sep 5, 2019

Do we have any section informing about current PrestaShop services? :) It would be nice to have it without having to look into the code.

@matks

This comment has been minimized.

Copy link
Contributor Author

commented Sep 6, 2019

Do we have any section informing about current PrestaShop services? :) It would be nice to have it without having to look into the code.

I'm afraid there are hundred of them 😐 so it would be a veryyyyy long list

I think you ask for this because you have a need 😉 can you tell me what is this need ? Maybe there's another more efficient solution than a list for this need

@PierreRambaud

This comment has been minimized.

Copy link
Contributor

commented Sep 6, 2019

Guys, i'm stupid
@kpodemski You can use

./bin/console debug:container

To list all available services.

@matks

This comment has been minimized.

Copy link
Contributor Author

commented Sep 6, 2019

Guys, i'm stupid

I dont know why you say this 😄

But even the services list is not helpful. Maybe @kpodemski needs something more than a list ?

@kpodemski

This comment has been minimized.

Copy link
Contributor

commented Sep 6, 2019

@matks

yeah i was asking for a PrestaShop specific services, sorry for not being precise ;-)

anyway, thanks @PierreRambaud - i never needed to use this one

@matks

This comment has been minimized.

Copy link
Contributor Author

commented Sep 6, 2019

@matks

yeah i was asking for a PrestaShop specific services, sorry for not being precise ;-)

There are still dozen of them 😅 we follow the single responsibility principle to make the code as simple and decoupled as possible (and avoid scary god classes).

The cool thing about it is that it's easy to customize using services override/decoration to customize only the part you want (instead of overriding the whole Product.php). The bad thing about it is it means a lot of services.

@kpodemski

This comment has been minimized.

Copy link
Contributor

commented Sep 6, 2019

@matks

IMO the more the better in this case, thanks to SRP it's a way better method to override some parts of the core, the only downside is that we need to wait for a next major version to have proper services on the front :)

@PierreRambaud

This comment has been minimized.

Copy link
Contributor

commented Sep 6, 2019

@kpodemski We are waiting for this too 😭 With twig in FO, could be awesome.

Copy link
Contributor

left a comment

Great addition @matks thanks
I wonder if we should try concurrential overrides/decorations between multiple modules to see what happens

…ervices override/decoration
@matks

This comment has been minimized.

Copy link
Contributor Author

commented Sep 12, 2019

Done, added a statement about console services list dump for @kpodemski and talked about interfaces usage for @jolelievre 😄

@matks matks merged commit 8989e73 into PrestaShop:master Sep 12, 2019
1 check was pending
1 check was pending
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@matks matks deleted the matks:explain-sf-service-decoration branch Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.