private function createAccess($randomId, $secret, $token, FriendRequest $request)
    {
        //1st step, remove any existing access
        $access = $this->om->getRepository('Claroline\CoreBundle\Entity\Oauth\ClarolineAccess')
            ->findOneByRandomId($randomId);

        if ($access === null) {
            $access = new ClarolineAccess();
        }

        $access->setRandomId($randomId);
        $access->setSecret($secret);
        $access->setAccessToken($token);
        $request->setIsActivated(true);
        $access->setFriendRequest($request);
        $this->om->persist($request);
        $this->om->persist($access);
        $this->om->flush();

        return $access;
    }
private function createAccess($randomId, $secret, $token, FriendRequest $request)
    {
        //1st step, remove any existing access
        $access = $this->om->getRepository('Claroline\CoreBundle\Entity\Oauth\ClarolineAccess')
            ->findOneByRandomId($randomId);

        if ($access === null) {
            $access = new ClarolineAccess();
        }

        $access->setRandomId($randomId);
        $access->setSecret($secret);
        $access->setAccessToken($token);
        $request->setIsActivated(true);
        $access->setFriendRequest($request);
        $this->om->persist($request);
        $this->om->persist($access);
        $this->om->flush();

        return $access;
    }
private function createAccess ( $ randomId , $ secret , $ token , FriendRequest $ request ) { //1st step, remove any existing access $ access = $ this -> om -> getRepository ( 'Claroline\CoreBundle\Entity\Oauth\ClarolineAccess' ) -> findOneByRandomId ( $ randomId ) ; if ( $ access === null ) { $ access = new ClarolineAccess ( ) ; } $ access -> setRandomId ( $ randomId ) ; $ access -> setSecret ( $ secret ) ; $ access -> setAccessToken ( $ token ) ; $ request -> setIsActivated ( true ) ; $ access -> setFriendRequest ( $ request ) ; $ this -> om -> persist ( $ request ) ; $ this -> om -> persist ( $ access ) ; $ this -> om -> flush ( ) ; return $ access ; }
Only 1 access per client !
Only 1 access per client !