main/core/Repository/WorkspaceRepository.php
public function findAllNonPersonalWorkspaces(
        $orderedBy = 'name',
        $order = 'ASC',
        User $user = null
    ) {
        $isAdmin = $user ? $user->hasRole('ROLE_ADMIN') : false;

        $qb = $this->createQueryBuilder('w')
          ->select('w')
          ->join('w.organizations', 'o')
          ->leftJoin('o.administrators', 'a')
          ->where('NOT EXISTS (
              SELECT u
              FROM Claroline\CoreBundle\Entity\User u
              JOIN u.personalWorkspace pw
              WHERE pw = w
          )');

        if (!$isAdmin) {
            $qb->andWhere('a.id = ?1')->setParameter(1, $user->getId());
        }

        $qb->orderBy("w.{$orderedBy}", $order);

        return $qb->getQuery()->getResult();
    }
public function findAllNonPersonalWorkspaces(
        $orderedBy = 'name',
        $order = 'ASC',
        User $user = null
    ) {
        $isAdmin = $user ? $user->hasRole('ROLE_ADMIN') : false;

        $qb = $this->createQueryBuilder('w')
          ->select('w')
          ->join('w.organizations', 'o')
          ->leftJoin('o.administrators', 'a')
          ->where('NOT EXISTS (
              SELECT u
              FROM Claroline\CoreBundle\Entity\User u
              JOIN u.personalWorkspace pw
              WHERE pw = w
          )');

        if (!$isAdmin) {
            $qb->andWhere('a.id = ?1')->setParameter(1, $user->getId());
        }

        $qb->orderBy("w.{$orderedBy}", $order);

        return $qb->getQuery()->getResult();
    }
public function findAllNonPersonalWorkspaces ( $ orderedBy = 'name' , $ order = 'ASC' , User $ user = null ) { $ isAdmin = $ user ? $ user -> hasRole ( 'ROLE_ADMIN' ) : false ; $ qb = $ this -> createQueryBuilder ( 'w' ) -> select ( 'w' ) -> join ( 'w.organizations' , 'o' ) -> leftJoin ( 'o.administrators' , 'a' ) -> where ( 'NOT EXISTS (
              SELECT u
              FROM Claroline\CoreBundle\Entity\User u
              JOIN u.personalWorkspace pw
              WHERE pw = w
          )' ) ; if ( ! $ isAdmin ) { $ qb -> andWhere ( 'a.id = ?1' ) -> setParameter ( 1 , $ user -> getId ( ) ) ; } $ qb -> orderBy ( "w.{$orderedBy}" , $ order ) ; return $ qb -> getQuery ( ) -> getResult ( ) ; }
Returns all non-personal workspaces.

@param string $orderedBy
@param string $order
@param User   $user

@return Workspace[]
Returns all non - personal workspaces .