Search code examples
modulezend-framework2zfcuser

zfcUser getState in another module


how could i getState from zfcUser

in view/index.phtml i get it from $this->zfcUserIdentity()->getState();

but now i need to get this value ( state for this user who is logged in ), in other module /controller (this is my costum module controller)

so i need to get State from: zfcUser/Entity/User to myModule/Controller

i watch this https://github.com/ZF-Commons/ZfcUser/wiki/How-to-check-if-the-user-is-logged-in but this solutons is not helpful


Solution

  • and this helps too, for me:

    $sm = $this->getServiceLocator();
    $auth = $sm->get('zfcuserauthservice');
    if ($auth->hasIdentity()) {
        $user_edit = $auth->getIdentity()->getPrem();
    }