Rewriting isAuthenticated () in symfony

I am doing a Practical symfony with Doctrine - Jobeet Job Website , just trying to understand how the backend works, I try to overwrite the isAuthenticated () function in the interface and the backend that I made is simple in my application \ frontend \ lib \ myUser.class.php file I made it publicly available

function isAuthenticated()
{
    return (bool)($this->authenticated && $this->getAttribute('is_customer', false, 'sfGuardSecurityUser'));
}

I also rewrite the signIn sfDoctrineGuard function like this

public function signIn($user, $remember = false, $con = null)
{
    parent::signIn($user, $remember, $con);
    if($this->authenticated){
        $this->setAttribute('is_customer', true, 'sfGuardSecurityUser');
    }
}

i did the same for the backend in \ backend \ lib \ myUser.class.php applications, but using is_admin everything is still perfect, just in the backend, when I am going to edit the Task, sfGuardSecurityUser in the session will be lost, why, because the isAuthenticated function (), which is called on this page, is located in the \ frontend \ lib \ myUser.class.php applications, so when I try to change the page I exit the system, the cuz isAuthenticated () function is called located in the applications \ backend \ lib \ myUser.class.php, it rarely sounds, but it only happens on the Jobs editing page, now I’m frozen yawl here, I hope you understand me and, to be more specific, when I turn on the reference / edit page, and I put in actionprint_r ($ _ SESSION) , I can see this snippet

[sfGuardSecurityUser] => Array
            (
                [user_id] => 1
                [is_admin] => 1
            )  

but if I reload the page, I no longer see this part, so when I try to change the page I exit the system and even more if I comment or remove isAuthenticated from the applications \ frontend \ lib \ myUser.class.php everything in the backend great, but I need to rewrite the function in the backend and interface

help is needed

thank

0
source share
1 answer

Try setting the exact session names in applications factories.yml:

all:
  storage:
      class: sfSessionStorage
      param:
        session_name: my_session_name
        session_cookie_domain: example.com
0
source

All Articles