2021-03-30 13:40:38 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Factory\Blog;
|
|
|
|
|
2021-05-12 12:04:03 +02:00
|
|
|
use App\Core\Factory\FactoryInterface;
|
2021-03-30 13:40:38 +02:00
|
|
|
use App\Entity\Blog\Comment;
|
|
|
|
use App\Entity\Blog\Post;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* class CommentFactory.
|
|
|
|
*
|
|
|
|
* @author Simon Vieille <simon@deblan.fr>
|
|
|
|
*/
|
2021-05-12 12:04:03 +02:00
|
|
|
class CommentFactory implements FactoryInterface
|
2021-03-30 13:40:38 +02:00
|
|
|
{
|
|
|
|
public function create(Post $post): Comment
|
|
|
|
{
|
|
|
|
$entity = new Comment();
|
|
|
|
|
|
|
|
$entity
|
|
|
|
->setPost($post)
|
2021-03-30 20:40:36 +02:00
|
|
|
->setIsActive(true)
|
|
|
|
;
|
2021-03-30 13:40:38 +02:00
|
|
|
|
|
|
|
return $entity;
|
|
|
|
}
|
|
|
|
}
|