Test Failed
Push — master ( 09192d...8ce185 )
by Pavel
04:15
created

MyEntity   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 6
c 2
b 0
f 0
lcom 0
cbo 1
dl 0
loc 86
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getParent() 0 4 1
A setParent() 0 4 1
A getPublicApiField() 0 4 1
A setPublicApiField() 0 4 1
A getId() 0 4 1
1
<?php
2
3
namespace ScayTrase\Api\Cruds\Tests\Fixtures\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use JMS\Serializer\Annotation as Serializer;
8
use Symfony\Component\Serializer\Annotation\MaxDepth;
9
10
/**
11
 * @ORM\Entity()
12
 */
13
class MyEntity
14
{
15
    /**
16
     * @var int|null
17
     * @ORM\Id()
18
     * @ORM\Column(type="integer")
19
     * @ORM\GeneratedValue(strategy="AUTO")
20
     */
21
    private $id;
22
23
    /**
24
     * @var string
25
     * @ORM\Column(type="string")
26
     */
27
    private $publicApiField;
28
29
    /**
30
     * @var string
31
     * @ORM\Column(type="string")
32
     */
33
    private $privateField;
34
35
    /**
36
     * @var MyEntity
37
     * @ORM\ManyToOne(targetEntity="MyEntity", inversedBy="children")
38
     */
39
    private $parent;
40
    /**
41
     * @var ArrayCollection|MyEntity[]
42
     * @ORM\OneToMany(targetEntity="MyEntity", mappedBy="parent", orphanRemoval=false)
43
     */
44
    private $children;
45
46
    /**
47
     * MyEntity constructor.
48
     *
49
     * @param string $privateField
50
     */
51
    public function __construct($privateField = 'test')
52
    {
53
        $this->privateField = $privateField;
54
        $this->children     = new ArrayCollection();
55
        $this->parent       = $this;
56
        $this->children->add($this);
57
    }
58
59
    /**
60
     * @return MyEntity
61
     */
62
    public function getParent()
63
    {
64
        return $this->parent;
65
    }
66
67
    /**
68
     * @param MyEntity $parent
69
     */
70
    public function setParent(MyEntity $parent = null)
71
    {
72
        $this->parent = $parent;
73
    }
74
75
    /**
76
     * @return string
77
     */
78
    public function getPublicApiField()
79
    {
80
        return $this->publicApiField;
81
    }
82
83
    /**
84
     * @param string $publicApiField
85
     */
86
    public function setPublicApiField($publicApiField)
87
    {
88
        $this->publicApiField = $publicApiField;
89
    }
90
91
    /**
92
     * @return mixed
93
     */
94
    public function getId()
95
    {
96
        return $this->id;
97
    }
98
}
99