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

MyEntity::getParent()   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
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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