1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Silverback\ApiComponentBundle\Entity\Content\Page\Dynamic; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use Doctrine\Common\Collections\Collection; |
7
|
|
|
use Doctrine\ORM\Mapping as ORM; |
8
|
|
|
use Ramsey\Uuid\Uuid; |
9
|
|
|
use Silverback\ApiComponentBundle\Entity\Content\Page\DynamicPage; |
10
|
|
|
use Silverback\ApiComponentBundle\Entity\Route\Route; |
11
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @ORM\Entity() |
15
|
|
|
* @ORM\InheritanceType("JOINED") |
16
|
|
|
* @ORM\DiscriminatorMap({ |
17
|
|
|
* "article_page" = "Silverback\ApiComponentBundle\Entity\Content\Page\Dynamic\ArticlePage\ArticlePage" |
18
|
|
|
* }) |
19
|
|
|
*/ |
20
|
|
|
abstract class DynamicContent extends DynamicContentBase |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @ORM\OneToMany(targetEntity="Silverback\ApiComponentBundle\Entity\Route\Route", mappedBy="dynamicContent", cascade={"persist"}) |
24
|
|
|
*/ |
25
|
|
|
protected $routes; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @ORM\Id() |
29
|
|
|
* @ORM\Column(type="string") |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
protected $id; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var DynamicPage|null |
36
|
|
|
* @Groups({"content", "route", "component"}) |
37
|
|
|
*/ |
38
|
|
|
private $dynamicPage; |
39
|
|
|
|
40
|
|
|
public function __construct() |
41
|
|
|
{ |
42
|
|
|
$this->id = Uuid::uuid4()->getHex(); |
43
|
|
|
$this->title = 'New dynamic page'; |
44
|
|
|
$this->routes = new ArrayCollection; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function getId(): string |
48
|
|
|
{ |
49
|
|
|
return $this->id; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function getDynamicPage(): ?DynamicPage |
53
|
|
|
{ |
54
|
|
|
return $this->dynamicPage; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function setDynamicPage(?DynamicPage $dynamicPage): void |
58
|
|
|
{ |
59
|
|
|
$this->dynamicPage = $dynamicPage; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function getParentRoute(): ?Route |
63
|
|
|
{ |
64
|
|
|
return null; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function getSortCollection(): ?Collection |
68
|
|
|
{ |
69
|
|
|
return null; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|