deblan.io-murph/src/Factory/Blog/PostFollowFactory.php
2022-02-06 19:36:10 +01:00

25 lines
552 B
PHP

<?php
namespace App\Factory\Blog;
use App\Core\Factory\FactoryInterface;
use App\Entity\Blog\Comment;
use App\Entity\Blog\Post;
use App\Entity\Blog\PostFollow as Entity;
class PostFollowFactory implements FactoryInterface
{
public function create(Post $post, Comment $comment): Entity
{
$entity = new Entity();
$entity
->setPost($post)
->setComment($comment)
->setIsEnabled(false)
->setHash(hash('sha256', bin2hex(random_bytes(32))))
;
return $entity;
}
}