public function getAvailableParentCategoriesQueryBuilder($categoryId = null)
    {
        $queryBuilder = $this
            ->createQueryBuilder('c')
            ->where('c.root = 1');

        if (null !== $categoryId) {
            $queryBuilder
                ->andWhere('c.id <> :parent_category')
                ->setParameter('parent_category', $categoryId);
        }

        return $queryBuilder;
    }
public function getAvailableParentCategoriesQueryBuilder($categoryId = null)
    {
        $queryBuilder = $this
            ->createQueryBuilder('c')
            ->where('c.root = 1');

        if (null !== $categoryId) {
            $queryBuilder
                ->andWhere('c.id <> :parent_category')
                ->setParameter('parent_category', $categoryId);
        }

        return $queryBuilder;
    }
public function getAvailableParentCategoriesQueryBuilder ( $ categoryId = null ) { $ queryBuilder = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.root = 1' ) ; if ( null !== $ categoryId ) { $ queryBuilder -> andWhere ( 'c.id <> :parent_category' ) -> setParameter ( 'parent_category' , $ categoryId ) ; } return $ queryBuilder ; }
Get the available parent categories for the received, usually the
category itself and all the non root categories are excluded.

@param int|null $categoryId The category id

@return QueryBuilder
Get the available parent categories for the received usually the category itself and all the non root categories are excluded .