Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

add example Writing your own Route Enhancers #744

Closed
wants to merge 4 commits into from
Closed

add example Writing your own Route Enhancers #744

wants to merge 4 commits into from

Conversation

andrey1s
Copy link

No description provided.

use Symfony\Cmf\Component\Routing\Enhancer\RouteEnhancerInterface;

class SimpleEnhancer implements RouteEnhancerInterface
{
Copy link
Member

Choose a reason for hiding this comment

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

this code would be invalid, we should add a method that does something trivial to make the example complete.

@dbu
Copy link
Member

dbu commented Feb 26, 2016

great, thanks! lets complete this with implementing a method in the enhancer that does something simple so its self-contained.

{
public function enhance(array $defaults, Request $request)
{
//own logic
Copy link
Member

Choose a reason for hiding this comment

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

Let's show that one has to return the new defaults array like this:

public function enhance(array $defaults, Request $request)
{
    // ... tweak the $defaults array

    return $defaults;
}

@dbu
Copy link
Member

dbu commented Feb 27, 2016

looks good to me. @wouterj see something that needs to be fixed?
@andrey1s may i ask you to squash the commits into one?

wouterj added a commit that referenced this pull request Feb 27, 2016
@wouterj wouterj closed this in 9c92396 Feb 27, 2016
@wouterj wouterj removed the wip/poc label Feb 27, 2016
@wouterj
Copy link
Member

wouterj commented Feb 27, 2016

Thank you @andrey1s! I've merged your pull request into all versions of the documentation and did some minor formatting changes in b586f62

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants