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

[NodeBundle, GeneratorBundle] Deprecated the service method in Pages in favour of controller methods #290

Merged
merged 1 commit into from
Apr 10, 2015

Conversation

woutervandamme
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? yes
Fixed tickets #211

instead of putting logic in the entity pages (service method), it is now possible to just implement the SlugActionInterface and specify which controller method must be executed.

  • Gather feedback for my changes
  • update relevant CHANGELOG and UPGRADE files;

UPGRADE

Deprecated the service method in Pages in favour of controller methods

You need to remove the service method in your entities and replace them by implementing the SlugActionInterface. Add the method getControllerAction and make it return a callable string.

    public function getControllerAction()
    {
        return 'Bundle:Controller:service';
    }

In your controller just add the serviceAction method, let it handle the logic and set the renderContext in the request attributes.

    public function serviceAction(Request $request)
    {
        ..logic..
        $context['variable'] = $variable;

        $request->attributes->set('_renderContext',$context);
    }

@roderik roderik changed the title [NodeBundle, GeneratorBundle] deprecated service method [NodeBundle, GeneratorBundle] Deprecated the service method in Pages in favour of controller methods Apr 9, 2015
@roderik
Copy link
Contributor

roderik commented Apr 9, 2015

after open tasks and squash, 👍 for merge

@krispypen
Copy link
Contributor

@woutervandamme :)

squash-on-merge

$request = $event->getRequest();
$nodeTranslation = $request->attributes->get('_nodeTranslation');

if($nodeTranslation)
Copy link
Contributor

Choose a reason for hiding this comment

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

Check the Symfony coding standards for correct code structure (http://symfony.com/doc/current/contributing/code/standards.html - or format your code automatically in your IDE using Symfony coding standards :p).

@krispypen krispypen added this to the Q1 2015 - v3.1 milestone Apr 10, 2015
… it can intercept the SlugController.

If you want to do this, you must implement the SlugControllerActionInterface and specify the action to perform on which controller

removed comment from interface

added the listeners and event

added comment to the slug security event

removes twigEngine dependency

moved the security part over to a seperate event and put the rendering is seperate method

removes service method
@woutervandamme woutervandamme force-pushed the deprecate-service-method branch from ad47d88 to b463539 Compare April 10, 2015 08:45
krispypen added a commit that referenced this pull request Apr 10, 2015
[NodeBundle, GeneratorBundle] Deprecated the service method in Pages in favour of controller methods
@krispypen krispypen merged commit a917421 into Kunstmaan:master Apr 10, 2015
@woutervandamme woutervandamme deleted the deprecate-service-method branch May 5, 2015 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants