Completed
Push — master ( becf03...491f37 )
by Rafael
08:53
created

OrderBySimpleField::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 4
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\OrderBy\Common;
12
13
use Doctrine\ORM\QueryBuilder;
14
use Ynlo\GraphQLBundle\Model\OrderBy;
15
use Ynlo\GraphQLBundle\OrderBy\OrderByContext;
16
use Ynlo\GraphQLBundle\OrderBy\OrderByInterface;
17
18
class OrderBySimpleField implements OrderByInterface
19
{
20
    /**
21
     * @inheritDoc
22
     */
23
    public function __invoke(OrderByContext $context, QueryBuilder $qb, $alias, OrderBy $orderBy)
24
    {
25
        $column = $orderBy->getField();
26
        $qb->addOrderBy("{$alias}.$column", $orderBy->getDirection());
27
    }
28
}
29