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

Appearance settings

[Serializer] enable property info in framework bundle #19434

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
Closed

[Serializer] enable property info in framework bundle #19434

wants to merge 1 commit into from

Conversation

DavidBadura
Copy link
Contributor

@DavidBadura DavidBadura commented Jul 26, 2016

Q A
Branch? 3.1
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

I've been wondering why the datetime normalizer won't work in combination with object normalizer in symfony 3.1 by default. I also found nothing in the documentation. Only http://symfony.com/blog/new-in-symfony-3-1-datetime-normalizer but here is not described how to use it with the object normalizer and how to configure the config.yml.

After debugging i found out that the object normalizer don't use the new property info component. With my change, you can enabled it with following config:

    serializer:
         enabled: true
    property_info: ~

Should i add analog to enable_annotation an enable_property_info option?

    serializer:
         enabled: true
         enable_property_info: true
    property_info: ~

if ($this->isConfigEnabled($container, $config['property_info'])) {
$this->registerPropertyInfoConfiguration($config['property_info'], $container, $loader);
}

if ($this->isConfigEnabled($container, $config['serializer'])) {
Copy link
Member

Choose a reason for hiding this comment

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

Why moving this block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I check below if the service property_info exists (have you a better idea?). this assumes that property info is built before serializer.

@dunglas
Copy link
Member

dunglas commented Jul 26, 2016

Good catch! The new config flag isn't necessary because the ObjectNormalizer class already contains a test to determine if it can use the PropertyInfo component or not.

This PR must be merged in 3.1 as bug fix.

You're right, there are a lot of missing docs for the Symfony Serializer (this feature, the MaxDepth annotation, new normalizers like the data: URI one, new encoders...). I've started working on updating the doc but don't except PRs before the end of August (any help welcome, most PRs already include a documentation draft in their descriptions).

@DavidBadura
Copy link
Contributor Author

done :) should i create a new PR for symfony 3.1?

@dunglas
Copy link
Member

dunglas commented Jul 26, 2016

Thanks. No we are able to merge directly this PR in the right branch.

Status: reviewed

👍

@nicolas-grekas
Copy link
Member

Thank you @DavidBadura.

nicolas-grekas added a commit that referenced this pull request Jul 27, 2016
…id Badura)

This PR was submitted for the master branch but it was merged into the 3.1 branch instead (closes #19434).

Discussion
----------

[Serializer] enable property info in framework bundle

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

I've been wondering why the datetime normalizer won't work in combination with object normalizer in symfony 3.1 by default. I also found nothing in the documentation. Only http://symfony.com/blog/new-in-symfony-3-1-datetime-normalizer but here is not described how to use it with the object normalizer and how to configure the config.yml.

After debugging i found out that the object normalizer don't use the new property info component. With my change, you can enabled it with following config:

```yml
    serializer:
         enabled: true
    property_info: ~
```

Should i add analog to `enable_annotation` an `enable_property_info` option?

```yml
    serializer:
         enabled: true
         enable_property_info: true
    property_info: ~
```

Commits
-------

c02933d enable property info
@fabpot fabpot mentioned this pull request Jul 30, 2016
@DavidBadura DavidBadura deleted the object-normalizer-with-property-info branch August 2, 2016 13:10
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.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.