<?php

namespace VGM\WOBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * CUnitRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class CUnitRepository extends EntityRepository
{
    public function findAllUnits()
    {
        $qb = $this->createQueryBuilder('u')
            ->orderBy('u.level')
            ->addOrderBy('u.name', 'ASC');

        $query = $qb->getQuery();

        return $query->getResult();
    }
    public function getSeedUnits()
    {
        $qb = $this->createQueryBuilder('u')
            ->where('u.level = 0')
            ->orderBy('u.name');

        $query = $qb->getQuery();

        return $query->getResult();
    }
}
