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

add union object normalizer #40

Open
wants to merge 1 commit into
base: 1.3.x
Choose a base branch
from
Open

Conversation

DavidBadura
Copy link
Member

No description provided.

@DavidBadura DavidBadura requested a review from DanielBadura April 5, 2024 15:48
@DavidBadura DavidBadura added the enhancement New feature or request label Apr 5, 2024
@DavidBadura DavidBadura added this to the 1.3.0 milestone Apr 5, 2024
Copy link

github-actions bot commented Apr 5, 2024

Hello 👋

here is the most recent benchmark result:

HydratorBench
=============

+-------------------------------+------------------+------------------+-----------------+------------+
|                               | time (kde mode)                     | memory                       |
+-------------------------------+------------------+------------------+-----------------+------------+
| subject                       | Tag: <current>   | Tag: base        | Tag: <current>  | Tag: base  |
+-------------------------------+------------------+------------------+-----------------+------------+
| benchHydrate1Object ()        | 2.500μs (±0.00%) | 2.500μs (±0.00%) | 4.759mb         | 4.759mb    |
| benchExtract1Object ()        | 2.800μs (±0.00%) | 2.600μs (±0.00%) | 4.759mb         | 4.759mb    |
| benchHydrate1000Objects ()    | 2.093ms (±0.00%) | 2.097ms (±0.00%) | 4.759mb         | 4.759mb    |
| benchExtract1000Objects ()    | 1.800ms (±0.00%) | 1.793ms (±0.00%) | 4.759mb         | 4.759mb    |
| benchHydrate1000000Objects () | 2.064s (±0.00%)  | 2.121s (±0.00%)  | 4.760mb         | 4.760mb    |
| benchExtract1000000Objects () | 1.692s (±0.00%)  | 1.688s (±0.00%)  | 4.760mb         | 4.760mb    |
+-------------------------------+------------------+------------------+-----------------+------------+

This comment gets update everytime a new commit comes in!

Copy link
Member

@DanielBadura DanielBadura left a comment

Choose a reason for hiding this comment

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

Feature itself LGTM.

Just thinking about instead of passing an array to the UnionObjectNormalizer leveraging the #[NormalizedName] Attribute or something like that. But also that is kina weird, since it does not really bring any value itself.

/** @param array<class-string, string> $classToTypeMap */
public function __construct(
private readonly array|null $classToTypeMap = null,
private readonly string $typeFieldName = '_type',
Copy link
Member

Choose a reason for hiding this comment

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

it's not the type but instead the type key right?

@DavidBadura DavidBadura removed this from the 1.3.0 milestone Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants