1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Kunstmaan\ArticleBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use Kunstmaan\ArticleBundle\Form\AbstractArticlePageAdminType; |
7
|
|
|
use Kunstmaan\ArticleBundle\PagePartAdmin\AbstractArticlePagePagePartAdminConfigurator; |
8
|
|
|
use Kunstmaan\NodeBundle\Entity\AbstractPage; |
9
|
|
|
use Kunstmaan\PagePartBundle\Helper\HasPagePartsInterface; |
10
|
|
|
|
11
|
|
|
abstract class AbstractArticlePage extends AbstractPage implements HasPagePartsInterface |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* The article's date, set automatically to 'now' before persisting when empty |
15
|
|
|
* |
16
|
|
|
* @var \DateTime |
17
|
|
|
* |
18
|
|
|
* @ORM\Column(type="datetime") |
19
|
|
|
*/ |
20
|
|
|
protected $date; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var string |
24
|
|
|
* |
25
|
|
|
* @ORM\Column(name="summary", type="text", nullable=true) |
26
|
|
|
*/ |
27
|
|
|
protected $summary; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Return the date of this article |
31
|
|
|
* |
32
|
|
|
* @param \DateTime $date |
33
|
|
|
*/ |
34
|
1 |
|
public function setDate($date) |
35
|
|
|
{ |
36
|
1 |
|
$this->date = $date; |
37
|
1 |
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Set the date of the article |
41
|
|
|
* |
42
|
|
|
* @return \DateTime |
43
|
|
|
*/ |
44
|
1 |
|
public function getDate() |
45
|
|
|
{ |
46
|
1 |
|
return $this->date; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Set the summary of this article |
51
|
|
|
* |
52
|
|
|
* @param $summary |
53
|
|
|
*/ |
54
|
1 |
|
public function setSummary($summary) |
55
|
|
|
{ |
56
|
1 |
|
$this->summary = $summary; |
57
|
1 |
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Returns the summary of this article |
61
|
|
|
* |
62
|
|
|
* @return string |
63
|
|
|
*/ |
64
|
1 |
|
public function getSummary() |
65
|
|
|
{ |
66
|
1 |
|
return $this->summary; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return array |
71
|
|
|
*/ |
72
|
1 |
|
public function getPossibleChildTypes() |
73
|
|
|
{ |
74
|
1 |
|
return array(); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* {@inheritdoc} |
79
|
|
|
*/ |
80
|
1 |
|
public function getDefaultAdminType() |
81
|
|
|
{ |
82
|
1 |
|
return AbstractArticlePageAdminType::class; |
83
|
|
|
} |
84
|
|
|
|
85
|
1 |
|
public function getAdminType() |
86
|
|
|
{ |
87
|
1 |
|
return $this->getDefaultAdminType(); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return array |
|
|
|
|
92
|
|
|
*/ |
93
|
1 |
|
public function getPagePartAdminConfigurations() |
94
|
|
|
{ |
95
|
1 |
|
return array(new AbstractArticlePagePagePartAdminConfigurator()); |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.