Skip to content

Remove use of deprecated security.exception_listener.class parameter #7898

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

Closed
wants to merge 5 commits into from

Conversation

ndench
Copy link
Contributor

@ndench ndench commented May 11, 2017

First, override the ``security.exception_listener.class`` parameter in your
configuration file. This can be done from your main configuration file (in
``app/config``) or from a configuration file being imported from a bundle:
First, add a ``CompilerPass`` which you will use to override the ``ExceptionListener`` class::
Copy link
Member

Choose a reason for hiding this comment

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

[...] add a compiler pass which [...]

Copy link
Member

Choose a reason for hiding this comment

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

and I would write "to replace" instead of "to override"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used override because that's the terminology from here: https://symfony.com/doc/current/bundles/override.html
But happy to change it :)

}

Next, create the ``ExceptionListenerPass`` to replace the definition of ``ExceptionListener``.
Make sure you use the name of the firewall you have configured in ``app/config``::
Copy link
Member

Choose a reason for hiding this comment

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

maybe: "[...] in your security configuration."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That does sound better, I'll change it.

{
// Use the name of your firewall as suffix e.g. 'secured_area'
$definition = $container->getDefinition('security.exception_listener.secured_area');
$definition->setClass('AppBundle\Security\Firewall\ExceptionListener');
Copy link
Member

Choose a reason for hiding this comment

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

we could use the class constant here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, I much prefer class constants too.

Copy link
Member

@xabbuh xabbuh left a comment

Choose a reason for hiding this comment

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

looks good to me, I just left some minor comments which we could also address while merging

@yceruto
Copy link
Member

yceruto commented May 12, 2017

I would like to reorder this, first would make the ExceptionListenerPass, then register it :) Thanks @ndench

@ndench
Copy link
Contributor Author

ndench commented May 12, 2017

@yceruto yeah I thought about ordering it that way, it makes more sense to implement as well because you get autocompletion from your IDE, I only went this way to be consistent with how it was before. I'm happy to reorder though, if we're not worried about keeping the same order as before?

Also, do you know why platformsh is failing? I get a 404 from the link.

@ndench
Copy link
Contributor Author

ndench commented May 12, 2017

@xabbuh I've made the changes you suggested, thanks for the review 😄

@xabbuh
Copy link
Member

xabbuh commented May 13, 2017

Reordering indeed was a good move. :)

@ndench
Copy link
Contributor Author

ndench commented May 13, 2017

Ok I've done the reordering, it does seem more intuitive.

@xabbuh xabbuh added this to the 2.7 milestone May 15, 2017
@xabbuh
Copy link
Member

xabbuh commented May 17, 2017

Thank you @ndench.

xabbuh added a commit that referenced this pull request May 17, 2017
…s parameter (ndench)

This PR was submitted for the 3.2 branch but it was merged into the 2.7 branch instead (closes #7898).

Discussion
----------

Remove use of deprecated security.exception_listener.class parameter

Reference: symfony/symfony#15534

Commits
-------

6fc36d0 Remove use of deprecated security.exception_listener.class parameter
@xabbuh xabbuh closed this May 17, 2017

use AppBundle\DependencyInjection\Compiler\ExceptionListenerPass;

class AppBundle extends Bundle
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use the kernel instead as of 3.3?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@HeahDude what do you mean?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean using https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Kernel.php#L446 instead, but this is not the good place to ask, and I guess will be part of a bigger update to get rid of AppBundle in the docs. So never mind :)

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.

6 participants