Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[JsonEncoder] AddJsonEncodable attribute#59401

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
chalasr merged 1 commit intosymfony:7.3frommtarld:feat/encodable-attribute
Jan 15, 2025

Conversation

mtarld
Copy link
Contributor

@mtarldmtarld commentedJan 7, 2025
edited
Loading

QA
Branch?7.3
Bug fix?no
New feature?yes
Deprecations?no
Issues
LicenseMIT

AddJsonEncodable attribute that autoconfiguresjson_encoder.encodable tag.

Kocal reacted with eyes emoji
@OskarStark
Copy link
Contributor

AsEncodableItem? Otherwise it does not match our As... naming or just "Encodable"?

mtarld and GromNaN reacted with thumbs up emoji

@mtarldmtarldforce-pushed thefeat/encodable-attribute branch 3 times, most recently from0e5c24d tob70b7eaCompareJanuary 7, 2025 15:53
@mtarldmtarld changed the title[JsonEncoder] AddAsEncodable attribute[JsonEncoder] AddEncodable attributeJan 7, 2025
@mtarldmtarldforce-pushed thefeat/encodable-attribute branch 4 times, most recently from0c4c28b to073610eCompareJanuary 7, 2025 16:24
@mtarldmtarldforce-pushed thefeat/encodable-attribute branch 2 times, most recently fromad8e5a0 to962ae14CompareJanuary 8, 2025 14:23
@mtarldmtarldforce-pushed thefeat/encodable-attribute branch from962ae14 to60fd915CompareJanuary 8, 2025 14:27
@mtarldmtarld changed the title[JsonEncoder] AddEncodable attribute[JsonEncoder] AddJsonEncodable attributeJan 8, 2025
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment
edited
Loading

Choose a reason for hiding this comment

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

LGTM, I like how we're using the container loading tools to do resource discovery quite seamlessly.

GromNaN reacted with thumbs up emoji
@mtarldmtarldforce-pushed thefeat/encodable-attribute branch from60fd915 toa12ad34CompareJanuary 13, 2025 09:21
@chalasr
Copy link
Member

Thank you@mtarld.

@chalasrchalasr merged commitd096737 intosymfony:7.3Jan 15, 2025
11 checks passed
@mtarldmtarld deleted the feat/encodable-attribute branchJanuary 15, 2025 20:58
nicolas-grekas added a commit that referenced this pull requestFeb 11, 2025
…)` and `ContainerBuilder::findExcludedServiceIds()` for auto-discovering value-objects (GromNaN)This PR was squashed before being merged into the 7.3 branch.Discussion----------[DependencyInjection] Add `Definition::addExcludedTag()` and `ContainerBuilder::findExcludedServiceIds()` for auto-discovering value-objects| Q             | A| ------------- | ---| Branch?       | 7.3| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Issues        | -| License       | MITWe could **not** use the method `findTaggedServiceIds` in#59401 (comment), same forapi-platform/core#6943.As "using the container loading tools to do resource discovery quite seamlessly" [seems to be a good idea](#59401 (review)), this changes make it easier.I'm not closed to alternative ideas if we want to go further with this use-case.### UsageLet's create a `AppModel` attribute class and use it on any class of the project.In the extension class:```php$this->registerAttributeForAutoconfiguration(AppModel::class, static function (ChildDefinition $definition) {    $definition->addExcludedTag('app.model');});```In a compiler pass:```php$classes = [];foreach($containerBuilder->findExcludedServiceIds('app.model') as $id => $tags) {    $classes[] = $containerBuilder->getDefinition($id)->getClass();}$containerBuilder->setParameter('.app.model_classes', $classes);```And this parameter can be injected into a service, or directly update a service definition to inject this list of classes. The attribute parameters can be injected into the tag, and retrieved in the compiler pass, for more advanced configuration.Commits-------7a0443b [DependencyInjection] Add `Definition::addExcludedTag()` and `ContainerBuilder::findExcludedServiceIds()` for auto-discovering value-objects
@fabpotfabpot mentioned this pull requestMay 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stofstofstof left review comments

@KocalKocalKocal left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@GromNaNGromNaNGromNaN approved these changes

@chalasrchalasrchalasr approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
7.3
Development

Successfully merging this pull request may close these issues.

8 participants
@mtarld@OskarStark@chalasr@nicolas-grekas@GromNaN@stof@Kocal@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp