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

[5.x] Fix autoloading when addon has multiple service providers #11128

Open
wants to merge 4 commits into
base: 5.x
Choose a base branch
from

Conversation

duncanmcclean
Copy link
Member

This pull request changes the "base path" used when autoloading addon components, to prevent addons with multiple service providers from booting the same stuff multiple times.

Fixes #11082.

@jasonvarga
Copy link
Member

I've pushed up some changes so that "root level items" like config, routes, views, blueprints, etc will only get booted by the root provider.

I added handling so that if you have multiple providers at the root level, the root level items only get booted once.

So, now nested providers can have autoloadable things relative to them like tags, actions, etc.

|-- src
|   |-- Tags
|       |-- TagOne.php
|   |-- ServiceProvider.php             <-- this will load TagOne, routes, config, lang, views
|   |-- AnotherServiceProvider.php      <-- this will only load stuff inside its $tags/$fieldtypes/etc properties
|   |-- Modules
|       |-- Something
|           |-- Tags
|           |   |-- AnotherTag.php
|           |-- ServiceProvider.php     <-- this will load AnotherTag, but not routes/config/lang/views
|-- routes
|   |-- web.php
|-- config
|   |-- addon.php 
|-- resources
    |-- lang
    |-- views

@jasonvarga jasonvarga requested a review from edalzell December 13, 2024 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Addon update called many times
2 participants