i am using guard as my custom authenticator, i need to send an email inside the authenticator, using the service fos_user.mailer that i injected which has arguments amoung which there is twig because it renders the message it needs to send, now the problem i have is that i get an error "Circular reference detected for service ..." which says that my authenticator calls the mailer which calls the twig which again calls the authorization checker (my authenticator) resulting in an endless loop, do you have any solutions for this
calling twigswiftmailer inside Guard Authenticator in symfony 2
89 Views Asked by ZeSoft At
1
There are 1 best solutions below
Related Questions in TWIG
- Adding a callback when reading from an object in Twig
- Using Twig variable in AngularsJS
- Twig : Unescape hexadecimal text
- Display a findAll() result in a form
- how tune twig without whitespaces
- Symfony2 wildcard routing
- Symfony2 get route name without locale prefix
- traverse twig array in javascript block
- How to check if array has more elements in twigs for loop?
- Inject variable into extended twig form_theme
- How To Pass A Twig Output String Into the urlFor() Function
- Where has the Twig function 'render' in templates gone?
- Edit a full HTML file from PHP using TWIG
- Extending core symfony Form Bootstrap Theme
- Using Twig Variables inside config.yml
Related Questions in SYMFONY-2.8
- How can I force the symfony entity-manager to recognize existing sub-entities?
- Best way to manage customizable texts in Symfony 2?
- Removing ChoiceType transformers during Pre Submit events
- JMS Serializer not serializing child classes
- Symfony 2 - How to allow a entities variable which is an object of another entity to be null?
- Symfony form - set DateType on Twig
- FOSUserBundle - How to call new password and confirm new password in edit.html.twig?
- Symfony save multiple entities
- how to get custom google sign-in link in php symfony2
- Symfony Controller return array
- Make file not nullable in VichUploaderBundle
- How to get uuid(dynamic value) in FeatureContext method
- symfony 2.8 production app.php does not take URL correctly from Nginx
- Symfony 2 and AngularJs Prerender.io not working
- Two Sonata Admin Panel Bundles in one Symfony application
Related Questions in SYMFONY-GUARD
- OAuth2 Symfony Api postman not passing by the guard authenticator
- symfony guard authenticator is not being called
- Symfony 5 / login-signin / Guard authentication
- Symfony Guard Authenticator customize logout function
- Symfony - Guard authenticator lost user after success login
- Authenticate anonymously with roles
- Symfony PHPUnit tests don't authenticate user
- Symfony's Guard start() function not working
- symfony security guard with locale not working
- Symfony 4 guard not authenticate user
- Symfony2 guard inactive session lifetime
- Symfony3 Guard and login form
- symfony3 guard login form doesn't authenticate
- Symfony4 guard authenticator doesn't work, no errors returned when log in
- symfony3 configuration with yaml
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The quick and dirty workaround is to inject the container to your authenticator and get the mailer service when you need it. It's dirty, because it hides your dependencies.
But why do you need to send an email in your authenticator? Can you use one of symfony's authentication-related events instead? (See the AuthenticationEvents and SecurityEvents classes). If that's not enough, you can also create your own event and listen to that in a different service, that's responsible for sending that mail.