Total Complexity | 4 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Coverage | 30% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | class News extends AbstractModel |
||
20 | { |
||
21 | private const IMAGE_PATH = 'htdocs/news/'; |
||
22 | |||
23 | use HasName; |
||
24 | use HasDescription; |
||
25 | use HasDate; |
||
26 | |||
27 | /** |
||
28 | * @var Collection |
||
29 | * @ORM\OneToMany(targetEntity="Comment", mappedBy="news") |
||
30 | */ |
||
31 | private $comments; |
||
32 | |||
33 | 3 | public function __construct() |
|
34 | { |
||
35 | 3 | $this->comments = new ArrayCollection(); |
|
36 | 3 | } |
|
37 | |||
38 | /** |
||
39 | * Get comments sent to the news |
||
40 | * |
||
41 | * @return Collection |
||
42 | */ |
||
43 | public function getComments(): Collection |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Notify the news that it has a new comment |
||
50 | * This should only be called by Comment::setNews() |
||
51 | * |
||
52 | * @param Comment $comment |
||
53 | */ |
||
54 | public function commentAdded(Comment $comment): void |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Notify the news that a comment was removed |
||
61 | * This should only be called by Comment::setNews() |
||
62 | * |
||
63 | * @param Comment $comment |
||
64 | */ |
||
65 | public function commentRemoved(Comment $comment): void |
||
70 |