| 1 | <?php |
||
| 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') |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return MyEntity |
||
| 60 | */ |
||
| 61 | public function getParent() |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param MyEntity $parent |
||
| 68 | */ |
||
| 69 | public function setParent(MyEntity $parent = null) |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @return string |
||
| 76 | */ |
||
| 77 | public function getPublicApiField() |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @param string $publicApiField |
||
| 84 | */ |
||
| 85 | public function setPublicApiField($publicApiField) |
||
| 89 | |||
| 90 | /** |
||
| 91 | * @return mixed |
||
| 92 | */ |
||
| 93 | public function getId() |
||
| 97 | } |
||
| 98 |