symfony / recipes-contrib

Symfony Contrib Recipes Repositories

Home Page:https://github.com/symfony/recipes-contrib/blob/flex/main/RECIPES.md

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[RFC] Directory name for metadata configuration

covex-nn opened this issue · comments

In my PR #302 with an Entity class i included two files with metadata configuration: SonataNotificationMessage.orm.xml for Doctrine ORM mapping and Entity.SonataNotificationMessage.xml for JMS serializer. I put that files into metadata/doctrine/ and metadata/jms_serializer/ directories accordingly.

First i tried to put metadata/ directory to config/metadata/ of course, but my files did not pass Flex Server validation: i've got error Underscore notation is required for file names under config/. And i could not rename them, because files with underscore notation are not supported by doctrine bundle and jms serializer bundle.

And from one side i cannot put my files into config/ because of validation, but from another side i cannot put them into metadata/ because it is not standard directory name for such important files. A same problem with naming i've got in my another PR #293.

So, my question is - where i should put my files with metadata configuration?

To find metadata configuration JMS Serializer uses Metadata\Driver\FileLocator::findFileForClass

Doctrine ORM bundle loads metadata configuration from files with .orm.xml extension

@Nyholm so, anyway filenames will contain dots and i cannot use Underscore notation for them. May be config/metadata/ directory could be excluded from validation?

I thought, what if Underscore notation is required error is not about dots in filename, and files must be renamed from SonataNotificationMessage.orm.xml to sonata_notification_message.orm.xml? But, anyway jms serializer bundle and doctrine bundle will not find renamed files.