Created
September 8, 2017 09:45
-
-
Save pchelk1n/27973dd2aa78dd27eb9ebb503c32e76f to your computer and use it in GitHub Desktop.
Select spec for https://github.com/Happyr/Doctrine-Specification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Entity\Spec; | |
use Doctrine\ORM\QueryBuilder; | |
use Happyr\DoctrineSpecification\Query\QueryModifier; | |
/** | |
* Class Select | |
*/ | |
class Select implements QueryModifier | |
{ | |
/** | |
* @var string field | |
*/ | |
protected $alias; | |
/** | |
* @param string $alias | |
*/ | |
public function __construct($alias) | |
{ | |
$this->alias = $alias; | |
} | |
/** | |
* @param QueryBuilder $qb | |
* @param string $dqlAlias | |
*/ | |
public function modify(QueryBuilder $qb, $dqlAlias) | |
{ | |
$qb->addSelect($this->alias); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use
variants - alias