Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Routing] Allow to set name prefixes from the configuration#25178

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@sroze
Copy link
Contributor

@srozesroze commentedNov 27, 2017
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#19612
LicenseMIT
Doc PRø

This allows setting name prefixes to routes while importing them. Typically, we can then import multiple times a similar file. This was originally requested by 🎸@chrisguitarguy in#19612

app:resource:../controller/routing.ymlapi:resource:../controller/routing.ymlname_prefix:api_prefix:/api
<?xml version="1.0" encoding="UTF-8" ?><routesxmlns="http://symfony.com/schema/routing"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://symfony.com/schema/routing        http://symfony.com/schema/routing/routing-1.0.xsd">    <importresource="../controller/routing.xml" />    <importresource="../controller/routing.xml"prefix="/api"name-prefix="api_" /></routes>

chrisguitarguy, jvasseur, roberto910907, and raplider reacted with thumbs up emojiKoc reacted with hooray emoji
@srozesrozeforce-pushed thefeature/19612-add-name-prefix-to-routes branch from0875723 toe0a8690CompareNovember 27, 2017 17:20
@stofstof added this to the4.1 milestoneNov 27, 2017
publicfunctiontestAddNamePrefix()
{
$collection =newRouteCollection();
$collection->add('foo',$foo =newRoute('/foo'));
Copy link
Member

Choose a reason for hiding this comment

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

please also add an existingapi_foo route, to be sure that the prefixing does not delete this route due to overriding.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Good catch, added.

@stof
Copy link
Member

Does the PHP DSL also need this feature, or is it already available in it ?

@srozesrozeforce-pushed thefeature/19612-add-name-prefix-to-routes branch 2 times, most recently from841d5ee toa4c836cCompareNovember 28, 2017 05:14
@sroze
Copy link
ContributorAuthor

@stof it was't. I've added it to the trait.

@sroze
Copy link
ContributorAuthor

Status: Needs review

}

/**
* Add a prefix to the name of all the routes within the collection.
Copy link
Member

Choose a reason for hiding this comment

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

Adds

}

/**
* Add a prefix to the name of all the routes within in the collection.
Copy link
Member

Choose a reason for hiding this comment

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

Adds

/**
* Add a prefix to the name of all the routes within in the collection.
*
* @param string $prefix
Copy link
Member

Choose a reason for hiding this comment

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

Should be removed

/**
* Add a prefix to the name of all the routes within the collection.
*
* @param string $prefix
Copy link
Member

Choose a reason for hiding this comment

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

Should be removed

*
* @return $this
*/
finalpublicfunctionaddNamePrefix(string$prefix)
Copy link
Member

Choose a reason for hiding this comment

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

: self to fully get rid of the phpdoc?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Well, we still need the description I'd say, as it's meant to be used by developers

Copy link
Member

Choose a reason for hiding this comment

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

Getting rid of@return $this would be nice though.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

but... on the trait I'm not sure if this makes sense... as (at least in my mind)self refers to the trait here, not the classuseing the trait.

Copy link
Member

Choose a reason for hiding this comment

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

There is no such thing as referring to a trait. PHP merges traits into the class, so self will always point to the correct class.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I was talking conceptually, by reading this. But if you two believe it's better just to putself within the trait, I'm happy with it as I don't mind that much tbh. Changed 👍

@srozesrozeforce-pushed thefeature/19612-add-name-prefix-to-routes branch froma4c836c to9f7c4e7CompareDecember 1, 2017 15:26
Copy link
ContributorAuthor

@srozesroze left a comment

Choose a reason for hiding this comment

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

Updated based on@fabpot's comments.

*
* @return $this
*/
finalpublicfunctionaddNamePrefix(string$prefix)
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Well, we still need the description I'd say, as it's meant to be used by developers

@srozesrozeforce-pushed thefeature/19612-add-name-prefix-to-routes branch from9f7c4e7 todd15433CompareDecember 1, 2017 16:01
Add the `addNamePrefix` method to the PHP trait
@srozesrozeforce-pushed thefeature/19612-add-name-prefix-to-routes branch fromdd15433 toe895402CompareDecember 1, 2017 16:02
@fabpot
Copy link
Member

Thank you@sroze.

@fabpotfabpot closed thisDec 2, 2017
fabpot added a commit that referenced this pull requestDec 2, 2017
…ation (sroze)This PR was squashed before being merged into the 4.1-dev branch (closes#25178).Discussion----------[Routing] Allow to set name prefixes from the configuration| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#19612| License       | MIT| Doc PR        | øThis allows setting name prefixes to routes while importing them. Typically, we can then import multiple times a similar file. This was originally requested by 🎸@chrisguitarguy in#19612```yamlapp:    resource: ../controller/routing.ymlapi:    resource: ../controller/routing.yml    name_prefix: api_    prefix: /api``````xml<?xml version="1.0" encoding="UTF-8" ?><routes xmlns="http://symfony.com/schema/routing"        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xsi:schemaLocation="http://symfony.com/schema/routinghttp://symfony.com/schema/routing/routing-1.0.xsd">    <import resource="../controller/routing.xml" />    <import resource="../controller/routing.xml" prefix="/api" name-prefix="api_" /></routes>```Commits-------880d7e7 [Routing] Allow to set name prefixes from the configuration
@srozesroze deleted the feature/19612-add-name-prefix-to-routes branchDecember 2, 2017 17:38
nicolas-grekas added a commit that referenced this pull requestMar 19, 2018
…rekas)This PR was merged into the 4.1-dev branch.Discussion----------[Routing] Fix name-prefixing when using PHP DSL| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Fixes bad implem merged in#25178Commits-------0053eee [Routing] Fix name-prefixing when using PHP DSL
@fabpotfabpot mentioned this pull requestMay 7, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@chalasrchalasrchalasr left review comments

@stofstofstof requested changes

@fabpotfabpotfabpot approved these changes

+1 more reviewer

@SimperfitSimperfitSimperfit approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

6 participants

@sroze@stof@fabpot@Simperfit@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp