-
-
Notifications
You must be signed in to change notification settings - Fork 586
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
Support *.yaml extension #1077
Comments
@goetas if you have ideas how to implement it without heavy refactoring - we can take the implementation part. My idea is, as soon this is the protected method - is to create some kind of btw, random question. is there any sense in |
My idea here is just to crate another metadata diver (as example
There are plenty of other libs that use jms/metadata as independent package for other propuses rather that serializations (see https://packagist.org/packages/jms/metadata/dependents), so yes, it makes sense |
What about inheritance? As soon as Your idea is very simple and I though of it too beforehand. This could be implemented easy. |
I'm a strong believer of composition over inherentance, so unless you have a particular reason for inheritance here, I would prefer composition. Regarding the naming, to not break things, I think we should keep YamlDriver as it is and add YalDriver (it is inconsistent, but I have no better ideas). |
Me too. but I'm talking about other existing users who may inherit it already. This drivers have three layers of inheritance, so they are not so easy to hook up with composition for now.
Looks strange. How about |
Building the drivers using extension will be: $yaml = new YamlDriver($fileLocator, $this->propertyNamingStrategy, $this->typeParser, $this->expressionEvaluator);
$yml = new YmlFileDriver($fileLocator, $this->propertyNamingStrategy, $this->typeParser, $this->expressionEvaluator); versus using composition: $yaml = new YamlDriver($fileLocator, $this->propertyNamingStrategy, $this->typeParser, $this->expressionEvaluator);
$yml = new YmlFileDriver($yaml); Do not see advantages on inheritance yet... and the new |
function returning the file extension is protected. how do you override it with composition? Because public interface does not use the file or extension at all, so we can't just decorate it |
You can check if https://github.com/schmittjoh/metadata/blob/d2ef520eb331e00bddd1b9306eecca9302c57f16/src/Driver/AbstractFileDriver.php#L26 can be of any help |
Well, we can decorate the locator to make it ignore the given extension and forcibly use But if we do this, we can also implement universal YAML file loader which tries to load both |
What about simply overriding This will be ever better and will not require at all to create |
Sound nice, but |
Sounds good to me |
#1078 here it is |
*.yml
extension is currently hardcoded. https://github.com/schmittjoh/serializer/blob/master/src/Metadata/Driver/YamlDriver.php#L290It would be nice to support both, since
*.yaml
is considered canonical https://yaml.org/faq.htmlThe text was updated successfully, but these errors were encountered: