Completed
Push — master ( 8ce185...772880 )
by Pavel
04:21
created

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