[2.2][Routing] Used static to call constant in XmlFileLoader #6449

Merged
merged 1 commit into from Dec 27, 2012

Conversation

Projects
None yet
5 participants
Contributor

francisbesset commented Dec 21, 2012

It is more complicated to override XmlFileLoader if contants are called with self.
This PR replace self to static.

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
License of the code: MIT

fabpot added a commit that referenced this pull request Dec 27, 2012

merged branch francisbesset/routing_constant_usage (PR #6449)
This PR was merged into the master branch.

Commits
-------

18daa10 [Routing] Used static to call constant in XmlFileLoader

Discussion
----------

[2.2][Routing] Used static to call constant in XmlFileLoader

It is more complicated to override XmlFileLoader if contants are called with `self`.
This PR replace `self` to `static`.

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
License of the code: MIT

---------------------------------------------------------------------------

by piotrpasich at 2012-12-21T08:17:14Z

+1

@fabpot fabpot merged commit 18daa10 into symfony:master Dec 27, 2012

1 check passed

default The Travis build passed
Details
Member

Tobion commented Dec 27, 2012

I used self on purpose. You must override this method anyway if you want to parse custom element/attributes.
This is why it only works with the symfony namespace. @francisbesset @piotrpasich What's your use case for static?

Contributor

francisbesset commented Dec 27, 2012

Yes of course. I develop the BeSimpleI18nRoutingBundle, and I override YamlFileLoader and XmlFileLoader of Symfony Routing component.

static is needed for me for the XmlFileLoader::parseNode() because the logic is the same for my bundle and this method call protected methods.
I replaced self to static in XmlFileLoader::parseConfigs() to keep consistency of use static, but I override this method for my bundle.

Member

stof commented Dec 27, 2012

@francisbesset the idea suggested in FOSRestBundle, using the full power of XML namespace, was to use a custom XML namespace only for your own tags instead of duplicating the Sf2 tags

Member

Tobion commented Dec 27, 2012

@stof is right. That's what I suggested. Reinventing the tags in your own namespace does not make sense. Otherwise we would not need any namespaces. I don't see the point of this PR. @fabpot I think this should be reverted.

Owner

fabpot commented Dec 28, 2012

Then, what about removing those constants?

Member

Tobion commented Dec 28, 2012

I think the constants are good, first for code claritiy, second because it exposes the namespace that the xml file loader expects so somebody can use the information to create valid xml routing files.

Owner

fabpot commented Dec 28, 2012

reverted

fabpot added a commit that referenced this pull request Dec 28, 2012

Contributor

francisbesset commented Dec 28, 2012

@Tobion The XSD file is here for that.

Member

Tobion commented Dec 28, 2012

@francisbesset I don't understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment