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

OrderBySimpleField   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 3
c 1
b 0
f 0
dl 0
loc 9
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 4 1
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