Orderable::orderBy()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
crap 1
1
<?php
2
3
namespace LaravelDoctrine\Fluent\Relations\Traits;
4
5
trait Orderable
6
{
7
    /**
8
     * @param string $name
9
     * @param string $order
10
     *
11
     * @return $this
12
     */
13 2
    public function orderBy($name, $order = 'ASC')
14
    {
15 2
        $this->getAssociation()->setOrderBy([
16
            $name => $order
17 2
        ]);
18
19 2
        return $this;
20
    }
21
22
    /**
23
     * @return \Doctrine\ORM\Mapping\Builder\OneToManyAssociationBuilder
24
     */
25
    abstract public function getAssociation();
26
}
27