public function deleteUser($id)
    {
        $user = $this->getRepository()->find($id);

        if (!$user) {
            $this->app['logger.flash']->warning(Trans::__('general.phrase.user-not-exist'));

            return false;
        }

        $userId = $user->getId();
        if ($result = $this->getRepository()->delete($user)) {
            /** @var Repository\AuthtokenRepository $authtokenRepository */
            $authtokenRepository = $this->app['storage']->getRepository(Entity\Authtoken::class);
            $authtokenRepository->deleteTokens($userId);
        }

        return $result;
    }
public function deleteUser($id)
    {
        $user = $this->getRepository()->find($id);

        if (!$user) {
            $this->app['logger.flash']->warning(Trans::__('general.phrase.user-not-exist'));

            return false;
        }

        $userId = $user->getId();
        if ($result = $this->getRepository()->delete($user)) {
            /** @var Repository\AuthtokenRepository $authtokenRepository */
            $authtokenRepository = $this->app['storage']->getRepository(Entity\Authtoken::class);
            $authtokenRepository->deleteTokens($userId);
        }

        return $result;
    }
public function deleteUser ( $ id ) { $ user = $ this -> getRepository ( ) -> find ( $ id ) ; if ( ! $ user ) { $ this -> app [ 'logger.flash' ] -> warning ( Trans :: __ ( 'general.phrase.user-not-exist' ) ) ; return false ; } $ userId = $ user -> getId ( ) ; if ( $ result = $ this -> getRepository ( ) -> delete ( $ user ) ) { /** @var Repository\AuthtokenRepository $authtokenRepository */ $ authtokenRepository = $ this -> app [ 'storage' ] -> getRepository ( Entity \ Authtoken :: class ) ; $ authtokenRepository -> deleteTokens ( $ userId ) ; } return $ result ; }
Remove a user from the database.

@param int $id

@return int the number of affected rows
Remove a user from the database .