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

[Components][Routing] Fix addPrefix() sample code #3622

Merged
merged 1 commit into from
Mar 12, 2014
Merged

[Components][Routing] Fix addPrefix() sample code #3622

merged 1 commit into from
Mar 12, 2014

Conversation

bicpi
Copy link
Contributor

@bicpi bicpi commented Mar 1, 2014

Q A
Doc fix? yes
New docs? no
Applies to all
Fixed tickets -

The sample code used for demonstrating the
Symfony\Component\Routing\RouteCollection::addPrefix() method did not match the signature. I've updated the code to show the provided features when adding a nested route collection. + some minor fixes along the way.

->addOptions(array(...))
->setHost('admin.example.com')
->setMethods(array('POST'))
->setSchemes(array('https'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right about the wrong arguments to addPrefix, but I don't think the methods can be chained like this - it looks like they all return null: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Routing/RouteCollection.php#L149

@bicpi
Copy link
Contributor Author

bicpi commented Mar 11, 2014

@weaverryan Oh, thanks for verifying this fix, can't remember how that fluid usage slipped in... ;-)

But I've found another issue: The versionadded note below the addPrefix() example says that the addPrefix() method was added in Symfony 2.2. Mh, actually I foud that it existed since Symfony 2.0 and it was possible to add a prefix with this method or the addCollection() method. Currently I've removed this note in this PR, because listing all the methods that were new to 2.2 and then to 2.3 ()host, schemes, method etc.) did not seem to be a good option. What do you think?

@weaverryan
Copy link
Member

I agree and like how you handled it :). Thanks as always Philipp

weaverryan added a commit that referenced this pull request Mar 12, 2014
This PR was merged into the 2.3 branch.

Discussion
----------

[Components][Routing] Fix addPrefix() sample code

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets | -

The sample code used for demonstrating the
[`Symfony\Component\Routing\RouteCollection::addPrefix()`](http://api.symfony.com/2.3/Symfony/Component/Routing/RouteCollection.html#method_addPrefix) method did not match the signature. I've updated the code to show the provided features when adding a nested route collection. + some minor fixes along the way.

Commits
-------

e095c13 [Components][Routing] Fix addPrefix() sample code
@weaverryan weaverryan merged commit e095c13 into symfony:2.3 Mar 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants