Skip to content

[JsonEncoder] Allow to warm up arbitrary types #59396

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

Closed
wants to merge 1 commit into from

Conversation

mtarld
Copy link
Contributor

@mtarld mtarld commented Jan 7, 2025

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

Allow to configure types that will be warmed up during cache generation:

framework:
    json_encoder:
        types:
            - list<Foo>

This allows to pre-generate encoders/decoders for types we know that will be used, but that aren't simple classes (such as list of classes for example).

@carsonbot carsonbot added this to the 7.3 milestone Jan 7, 2025
@mtarld mtarld force-pushed the feat/warm-up-types branch 3 times, most recently from aa66777 to 11a0a1f Compare January 7, 2025 14:01
@mtarld
Copy link
Contributor Author

mtarld commented Jan 17, 2025

#59536 is an alternative approach to tackle this issue.

@mtarld mtarld deleted the feat/warm-up-types branch January 17, 2025 10:41
fabpot added a commit that referenced this pull request Jan 25, 2025
This PR was merged into the 7.3 branch.

Discussion
----------

[JsonEncoder] Allow to warm up object and list

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

As discussed with `@chalasr`, configuration in FrameworkBundle must be avoided as much as possible.
That's why #59396 might not be the way to go.

Instead, this PR addresses the most common use cases, which are warming up cache files for `GivenClass` and `list<GivenClass>`.

This can be configured by setting the `object` and `list` attributes of `json_encoder.encodable`, or `asObject` and `asList` of the `JsonEncodable` attribute accordingly.

Commits
-------

cb36ec0 [JsonEncoder] Allow to warm up item and list
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Jan 25, 2025
This PR was merged into the 7.3 branch.

Discussion
----------

[JsonEncoder] Allow to warm up object and list

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

As discussed with `@chalasr`, configuration in FrameworkBundle must be avoided as much as possible.
That's why symfony/symfony#59396 might not be the way to go.

Instead, this PR addresses the most common use cases, which are warming up cache files for `GivenClass` and `list<GivenClass>`.

This can be configured by setting the `object` and `list` attributes of `json_encoder.encodable`, or `asObject` and `asList` of the `JsonEncodable` attribute accordingly.

Commits
-------

cb36ec0d09b [JsonEncoder] Allow to warm up item and list
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.

3 participants