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

[Serializer] set context for property by Property Info Extractor #41227

Open
Warxcell opened this issue May 14, 2021 · 9 comments
Open

[Serializer] set context for property by Property Info Extractor #41227

Warxcell opened this issue May 14, 2021 · 9 comments

Comments

@Warxcell
Copy link
Contributor

Warxcell commented May 14, 2021

Description
Feature:

Currently, when serializing object - you have no way to set per property context (this is fixed in 5.3)

    /**
     * @Serializer\Context({ DateTimeNormalizer::FORMAT_KEY = 'H:i:s' })
     */
    public \DateTime $time;

    /**
     * @Serializer\Context({ DateTimeNormalizer::FORMAT_KEY = 'Y-m-d' })
     */
    public \DateTime $date;

But still, it would be nice these to happens automatically, with zero configuration, by writing custom property extractors that can fill context.

Above will be equivalent to:

/**
 * @ORM\Column(type="time") <= extractor will set H:i:s because it knows it's time only from ORM definition.
 */
public \DateTime $time;

/**
 * @ORM\Column(type="date") <= extractor will set Y-m-d because it knows it's date only from ORM definition.
 */
public \DateTime $date;

What do you think? If I have "YES" - I can start working on it?

@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@Warxcell
Copy link
Contributor Author

Yes.

@carsonbot carsonbot removed the Stalled label Nov 30, 2021
@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@carsonbot
Copy link

Could I get a reply or should I close this?

@Warxcell
Copy link
Contributor Author

yes

@carsonbot carsonbot removed the Stalled label Jun 14, 2022
@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@Warxcell
Copy link
Contributor Author

nzbrat

@carsonbot carsonbot removed the Stalled label Dec 15, 2022
@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@norkunas
Copy link
Contributor

yes

@carsonbot carsonbot removed the Stalled label Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants