Skip to content

Commit 3e4d7d0

Browse files
committed
initialize category entity
1 parent bd66632 commit 3e4d7d0

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/Blog/src/Entity/Category.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
declare(strict_types=1);
44

55
namespace Light\Blog\Entity;
6+
use Doctrine\Common\Collections\ArrayCollection;
67
use Doctrine\Common\Collections\Collection;
78
use Doctrine\ORM\Mapping as ORM;
89
use Light\App\Entity\AbstractEntity;
@@ -26,6 +27,12 @@ class Category extends AbstractEntity
2627
#[ORM\OneToMany(mappedBy: 'category', targetEntity: Post::class)]
2728
private Collection $posts;
2829

30+
public function __construct()
31+
{
32+
parent::__construct();
33+
34+
$this->posts = new ArrayCollection();
35+
}
2936
public function getName(): string
3037
{
3138
return $this->name;

0 commit comments

Comments
 (0)