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 answers
Related Questions in TWIG
- Writing each key once in twig
- How to install and use "Twig Component" with Slim4
- Isolate and wrap a numeral using a Twig filter?
- Building 2 differently styled sub menus
- Unable to Use RequestStacks for Adding Content to Line-Item Payload after Shopware 6.5.4.0
- Is it possible to pass an entire object through TwigFunction in twig template?
- How to output instance of DC2Type:array
- How to pass URL to custom function
- Neither the property nor one of the methods exists and has public access in the class, but exists
- Display Information with CRUD Controller (EasyAdmin 4 + Symfony 7)
- Hiding promotion / discount field
- Unable to display comment tree with twig macro
- Getting the value from a multi-select list PHP in Drupal site
- Escaping simple quote in TWIG
- Custom product details tab invisible on mobile in Shopware 6.5
Related Questions in SYMFONY-2.8
- Symfony 2.8 : why validator (constraint & validator) are not executed when I edit my entity
- Symfony knp_snappy bundle: Execute JS in the twig template to be printed as PDF
- Item gets deleted on flush even when I restore it
- symfony 2.8 AppKernel slowness
- Why do i have the error must be of type array, string given, in Symfony 2.8 during composer update
- DocuSign API embedded signature implementation Symfony
- Getting a managed and dirty entity error on persist
- Can't register Ratchet bundle from private git in AppKernel
- Docker Unable to connect to localhost
- Doctrine Query Builder add a count column of a related table
- Syfmony 2.8: You have requested a non-existent parameter "kernel.bundles_metadata"
- Absolute URL in template returns localhost in email templates
- Save Request class object to database - Symfony2
- Symfony Commands to run via CRON
- Route behaviour when the user is authenticated and not authenticated in Symfony 2
Related Questions in SYMFONY-GUARD
- Symfony PHPUnit tests don't authenticate user
- Authenticate anonymously with roles
- OAuth2 Symfony Api postman not passing by the guard authenticator
- Symfony Guard or Userprovider - username always null
- Symfony 5 / login-signin / Guard authentication
- Symfony 5 hanndle access for external tools (knpsnappy)
- Symfony4 guard authenticator doesn't work, no errors returned when log in
- Symfony 4 guard not authenticate user
- symfony guard authenticator is not being called
- Symfony - Guard authenticator lost user after success login
- Symfony authenticate user against remote API
- Symfony authentication with guard always return "Username could not be found."
- calling twigswiftmailer inside Guard Authenticator in symfony 2
- Silex Custom Auth with Guard
- Symfony Guard Authenticator customize logout function
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?
Popular Tags
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)
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.