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
[WIP] Update jms/serializer-bundle configuration #293
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
@goetas please, review changes |
From the technical point of view is correct. Since symfony "wiped-out" the AppBundle, this makes sense to me. So for me is 👎 as it is now. |
directories: | ||
app: | ||
namespace_prefix: "App" | ||
path: "%kernel.project_dir%/config/serializer" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the recommended directory to put metadata configurations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably the dir name should be jms_serializer
, to avoid conflicts with the symfony serializer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no recommended directory for such metadata configurations. But there was a discussion about a place of translations
directory:
First it was moved to /config/translations
(see symfony/recipes#249), but then it was moved back to the root of repository (see symfony/recipes#253) because Discoverability of this directory is important because it's one of those dirs that could be browsed by non backend developers (such as assets/ and templates/).
(c)
I've chosen config/serilizer
because metadata configuration files are stored in <bundle-directory>/Resources/config/serializer
for bundles and discoverabilty of config/serialier
directory is not important as for translations, and because metadata configuration is configuration =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about %kernel.project_dir%/config/metadata/jms_serializer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
Cache dir is %kernel.cache_dir%/jms_serializer
and metadata configuration will be in %kernel.project_dir%/config/metadata/jms_serializer
. Similar and unique )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cache dir is
%kernel.cache_dir%/jms_serializer
and metadata configuration will be in >%kernel.project_dir%/config/metadata/jms_serializer
. Similar and unique )
👍
# namespace_prefix: "My\\BarBundle" | ||
# path: "@MyBarBundle/Resources/config/serializer" | ||
metadata: | ||
auto_detection: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not remember if auto_detection: true
and directories
work well together
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they work together, i checked
see https://github.com/schmittjoh/JMSSerializerBundle/blob/master/DependencyInjection/JMSSerializerExtension.php#L130
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great! I forgot about it! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
I see you have commented back some part of it, should you comment everything?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
I thought I've commented |
I will comment everything just to not overload the user... If the user is using annotations (by experience most of them do), this section should be commented. I'm ok with suggesting nice defaults (ready to be un-commented by the user) but the user should not have to do extra operations most of the time. |
I will try to argue one more time (the last one =) Before Flex we had to create Anyway, i'd like to show you an examle: covex-nn@2e5da5c. This is a commit with recipe for
After
But after If you are still not agree with me, i will comment new directory in configuration. |
We could keep the directory mapping uncommented IMO. If the directory does not exist or does not have mapping in it, JMSSerializerBundle should be smart enough to detect this at build time, and so there won't be any performance impact to have it configured even when using annotations AFAIK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
Do nor remember if |
|
Then I'm ok with it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
@Nyholm PR is ready and reviewed. Please review or/and accept. |
I've got a error message when i tried to create a recipe for
So, if metadata directory will be inside |
43c8223
to
5429ac8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excuse my ignorance. But what is metadata? Is it code, configuration or temporary files? Will a developer ever change that metadata?
@@ -3,6 +3,7 @@ | |||
"JMS\\SerializerBundle\\JMSSerializerBundle": ["all"] | |||
}, | |||
"copy-from-recipe": { | |||
"config/": "%CONFIG_DIR%/" | |||
"config/": "%CONFIG_DIR%/", | |||
"metadata/": "metadata/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this always work? Don't we need a prefix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it will always work, because %CONFIG_DIR% === 'config'
@Nyholm i planned to put |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request passes validation.
@Nyholm metadata is configuration, that describes data for some purposes. Metadata configuration for |
Since “metadata” in this case actually is config, I would put it in the config dir. Let’s investigate in the issue with camelCase or snake_case. Good that you opened that issue. |
Closing PR, as we found another way |
With this PR new directory
%kernel.project_dir%/config/metadata/jms_serializer
will be created, where serialization metadata configuration should be stored for objects withApp
namespace prefix