Completed
Push — extensions-support ( 73dd44...1dda5d )
by Guido
04:41 queued 01:33
created

OneToOne   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 2
Metric Value
wmc 3
c 3
b 0
f 2
lcom 1
cbo 7
dl 0
loc 36
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createAssociation() 0 7 1
A __call() 0 8 2
1
<?php
2
3
namespace LaravelDoctrine\Fluent\Relations;
4
5
use Doctrine\ORM\Mapping\Builder\AssociationBuilder;
6
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
7
use LaravelDoctrine\Fluent\Builders\Traits\Macroable;
8
use LaravelDoctrine\Fluent\Builders\Traits\QueuesMacros;
9
use LaravelDoctrine\Fluent\Relations\Traits\Ownable;
10
use LaravelDoctrine\Fluent\Relations\Traits\Owning;
11
use LaravelDoctrine\Fluent\Relations\Traits\Primary;
12
13
/**
14
 * @method $this inversedBy($fieldName)
15
 * @method $this mappedBy($fieldName)
16
 */
17
class OneToOne extends AbstractRelation
18
{
19
    use Owning, Ownable, Primary, Macroable, QueuesMacros;
20
21
    /**
22
     * @param ClassMetadataBuilder $builder
23
     * @param string               $relation
24
     * @param string               $entity
25
     *
26 24
     * @return AssociationBuilder
27
     */
28 24
    protected function createAssociation(ClassMetadataBuilder $builder, $relation, $entity)
29 24
    {
30
        return $this->builder->createOneToOne(
31 24
            $relation,
32
            $entity
33
        );
34
    }
35
36
    /**
37
     * @param string $method
38
     * @param array  $args
39
     *
40
     * @throws \BadMethodCallException
41
     * @return $this
42
     */
43
    public function __call($method, $args)
44
    {
45
        if ($this->hasMacro($method)) {
46
            return $this->queueMacro($method, $args);
47
        }
48
49
        return parent::__call($method, $args);
50
    }
51
52
}
53