{"id":1533,"date":"2022-08-30T15:17:19","date_gmt":"2022-08-30T15:17:19","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/27\/symfony2-onauthenticationsuccess-handler-and-doctrine2-exception-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:17:19","modified_gmt":"2022-08-30T15:17:19","slug":"symfony2-onauthenticationsuccess-handler-and-doctrine2-exception-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/symfony2-onauthenticationsuccess-handler-and-doctrine2-exception-collection-of-common-programming-errors\/","title":{"rendered":"Symfony2 onAuthenticationSuccess handler and Doctrine2 exception-Collection of common programming errors"},"content":{"rendered":"<p>All! Could someone help me with Symfony2 question? I&#8217;d like to save into the database all the events (request related data) regarding user login [success, failure] and logout [success]. Implementation and exception below.<\/p>\n<p>Here is the config.yml<\/p>\n<pre><code>services:\n\nlogin_success_handler:\n    class:  Boomster\\LibraryBundle\\Handler\\LoginSuccessHandler\n    arguments:  [@security.context, @doctrine]\n\nlogin_failure_handler:\n    class:  Boomster\\LibraryBundle\\Handler\\LoginFailureHandler\n    arguments:  [@security.context, @doctrine]\n\nlogout_success_handler:\n    class:  Boomster\\LibraryBundle\\Handler\\LogoutSuccessHandler\n    arguments:  [@security.context, @doctrine]\n<\/code><\/pre>\n<p>Here is firewall security.yml<\/p>\n<pre><code>firewalls:\n    secured_area:\n        pattern: ^\/.*\n        form_login:\n            check_path: auth_check\n            login_path: auth_login\n            success_handler: login_success_handler\n            failure_handler: login_failure_handler\n        logout:\n            path:   auth_logout\n            target: site_index\n            success_handler: logout_success_handler\n        anonymous: ~\n<\/code><\/pre>\n<p>Here is LoginSuccessHandler handler:<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-27 05:07:24. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>All! Could someone help me with Symfony2 question? I&#8217;d like to save into the database all the events (request related data) regarding user login [success, failure] and logout [success]. Implementation and exception below. Here is the config.yml services: login_success_handler: class: Boomster\\LibraryBundle\\Handler\\LoginSuccessHandler arguments: [@security.context, @doctrine] login_failure_handler: class: Boomster\\LibraryBundle\\Handler\\LoginFailureHandler arguments: [@security.context, @doctrine] logout_success_handler: class: Boomster\\LibraryBundle\\Handler\\LogoutSuccessHandler arguments: [@security.context, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1533","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1533"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1533\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}