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

[DoctrineBridge] Add new file extension for YAML mapping #28154

Closed
ossinkine opened this issue Aug 7, 2018 · 13 comments
Closed

[DoctrineBridge] Add new file extension for YAML mapping #28154

ossinkine opened this issue Aug 7, 2018 · 13 comments
Labels
DoctrineBridge Help wanted Issues and PRs which are looking for volunteers to complete them.

Comments

@ossinkine
Copy link
Contributor

Description
At the moment, the Doctrine mapping with the yml type looks for files with the .orm.yml extension.
I suggest adding the .orm.yaml extension or adding the ability to specify an extension in config.

@nicolas-grekas
Copy link
Member

PR welcome.

@nicolas-grekas nicolas-grekas added the Help wanted Issues and PRs which are looking for volunteers to complete them. label Sep 7, 2018
@ismail1432
Copy link
Contributor

ismail1432 commented Sep 7, 2018

Maybe I'm wrong (it's happen often 😄) but the doc said that this use case is cover and the source code too

@chalasr
Copy link
Member

chalasr commented Sep 7, 2018

@ismail1432 You're right for the docs, but not for the code (the one you linked is about validation, not schema mapping) :).

I confirm that the .orm.yaml extension is not supported, first because of

if (!\in_array($mappingConfig['type'], array('xml', 'yml', 'annotation', 'php', 'staticphp'))) {
throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "php" or '.
.
But especially because of https://github.com/doctrine/doctrine2/blob/4e715727da55b5d54389dfdc749586ccf3b939d4/lib/Doctrine/ORM/Mapping/Driver/SimplifiedYamlDriver.php#L33.
So this requires a doctrine PR (as a bugfix on 2.x since everything about YAML has been removed from the master branch..).

@ossinkine
Copy link
Contributor Author

@chalasr You refer to the default file extension, but it can be overridden in SimplifiedYamlDriver constructor. We can add a new option to the bundle configurion.

@chalasr
Copy link
Member

chalasr commented Sep 9, 2018

@ossinkine you're right, we should be able to fix this in the bridge only.
I wouldn't add a new option though. I think both .orm.yml and .orm.yaml extensions should just work naturally when configuring yml as mapping type, and maybe allow using yaml as value for the type option, that would give the exact same behavior.

@rpkamp
Copy link
Contributor

rpkamp commented Sep 16, 2018

Or maybe we shouldn't help people using YAML for Doctrine mappings since it will be removed in Doctrine 3 anyway so the best thing to do for new projects is not using YAML at all for doctrine mappings (but rather XML or annotations).

@ossinkine
Copy link
Contributor Author

@rpkamp I didn't know that YAML is deprecated, but it seems it's true: doctrine/orm#7374

@gonzalovilaseca
Copy link
Contributor

Is anyone working on this PR?

@xabbuh
Copy link
Member

xabbuh commented Mar 8, 2019

I am 👎 on investing any time here as support for the YAML format will be dropped in Doctrine 3.

@vudaltsov
Copy link
Contributor

What if we copy Yaml loaders to the Doctrine Bridge? The Symfony community uses Yaml a lot, so why not supporting it on our side?

@xabbuh
Copy link
Member

xabbuh commented Jun 27, 2019

I am against that too. In the documentation we recommend to use annotations for configuring the Doctrine mappings. So IMO it's not worth to take over maintenance of the YAML driver. If someone's really interested in still having it supported, they should (from my point of view) create a new dedicated package for that.

@vudaltsov
Copy link
Contributor

I agree with you, @xabbuh. Then let's close this issue?

@fabpot fabpot closed this as completed Jun 27, 2019
@stof
Copy link
Member

stof commented Jun 27, 2019

Taking over the maintenance ourselves would be even worse, because it means that any mapping change in Doctrine would have to be ported to the external YAML driver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DoctrineBridge Help wanted Issues and PRs which are looking for volunteers to complete them.
Projects
None yet
Development

No branches or pull requests