Skip to content

[FrameworkBundle] Auto-exclude DI extensions, test cases, entities and messenger messages #59987

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

Merged
merged 1 commit into from
Mar 17, 2025

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
Issues -
License MIT

So that we can remove the exclude lines from the default recipe.

@nicolas-grekas nicolas-grekas force-pushed the exclude branch 2 times, most recently from 953288c to 3fbb3a4 Compare March 16, 2025 15:10
@nicolas-grekas nicolas-grekas changed the title [FrameworkBundle] Auto-exclude DI extensions, kernel, test cases and messenger messages [FrameworkBundle] Auto-exclude DI extensions, kernel, test cases, entities and messenger messages Mar 16, 2025
@nicolas-grekas

This comment was marked as outdated.

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, but I'm not sure for the Kernel.

@nicolas-grekas nicolas-grekas changed the title [FrameworkBundle] Auto-exclude DI extensions, kernel, test cases, entities and messenger messages [FrameworkBundle] Auto-exclude DI extensions, test cases, entities and messenger messages Mar 17, 2025
@nicolas-grekas
Copy link
Member Author

I removed the rule for the kernel: its not needed, we already override the auto-discovered App\Kernel class by an alias to kernel.

@fabpot
Copy link
Member

fabpot commented Mar 17, 2025

Thank you @nicolas-grekas.

@fabpot fabpot merged commit e09e68f into symfony:7.3 Mar 17, 2025
9 of 11 checks passed
@fabpot
Copy link
Member

fabpot commented Mar 17, 2025

Related recipe PR: symfony/recipes#1391

@janklan
Copy link

janklan commented Apr 7, 2025

It doesn't seem like I can opt-out from this, can I?

I wanted several entities to be discoverable by a service locator, so I made some of them implement a tagged interface to do so.

The purpose of that is that several our entities define custom SQL behaviour outside of the scope of ORM/DBAL (triggers, stored functions, ...) and because the SQL is tightly coupled with those entities, I thought it would be OK to just add a public function provideCustomQueries(): \Generator method to entities that need it. Later on, I'm listening to the migrationsMigrated event in a service that collects said entities, iterates through the list, extracts the custom SQL and executes whatever the entities want to do.

--

Update: never mind. I tweaked my custom SQL mechanism to rely on Doctrine's class metadata to find known entities that implement specific interfaces. I guess the entire mechanism relates to Doctrine, so using the container to find the right classes was more elegant but not entirely required.

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Apr 9, 2025
… from the default services file (Jean-Beru)

This PR was merged into the 7.3 branch.

Discussion
----------

[FrameworkBundle] Remove DI, Entity and Kernel exclusion from the default services file

Since symfony/symfony#59987 and according to the [recipe](https://github.com/symfony/recipes/blob/main/symfony/framework-bundle/7.3/config/services.yaml), the default `config/services.yaml` does not exclude DI, Entity and Kernel file/folders anymore.

Commits
-------

70716ab Update service_container.rst to 7.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants