<?php

namespace Lc\SovBundle\Doctrine;

use Doctrine\ORM\QueryBuilder as DoctrineQueryBuilder;

/**
 * class QueryBuilder.
 *
 * @author La clic !!!!
 */
class QueryBuilder extends DoctrineQueryBuilder
{

    public function andWhereParent($dqlId, $entityId):self
    {
        $this->andWhere($dqlId.'.parent = :entityId');
        $this->setParameter('entityId', $entityId);
        return $this;
    }

    public function andWhereParentIsNull($dqlId):self
    {
        $this->andWhere($dqlId.'.parent IS NULL');
        return $this;
    }

    public function andWhereStatus($dqlId, $status){
        $this->andWhere($dqlId.'.status = :status');
        $this->setParameter('status', $status);
        return $this;
    }

}
