We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd66632 commit 3e4d7d0Copy full SHA for 3e4d7d0
1 file changed
src/Blog/src/Entity/Category.php
@@ -3,6 +3,7 @@
3
declare(strict_types=1);
4
5
namespace Light\Blog\Entity;
6
+use Doctrine\Common\Collections\ArrayCollection;
7
use Doctrine\Common\Collections\Collection;
8
use Doctrine\ORM\Mapping as ORM;
9
use Light\App\Entity\AbstractEntity;
@@ -26,6 +27,12 @@ class Category extends AbstractEntity
26
27
#[ORM\OneToMany(mappedBy: 'category', targetEntity: Post::class)]
28
private Collection $posts;
29
30
+ public function __construct()
31
+ {
32
+ parent::__construct();
33
+
34
+ $this->posts = new ArrayCollection();
35
+ }
36
public function getName(): string
37
{
38
return $this->name;
0 commit comments