diff --git a/old/src/PointToolsBundle/Repository/Blogs/CommentRepository.php b/old/src/PointToolsBundle/Repository/Blogs/CommentRepository.php deleted file mode 100644 index a4f1213..0000000 --- a/old/src/PointToolsBundle/Repository/Blogs/CommentRepository.php +++ /dev/null @@ -1,14 +0,0 @@ -getEntityManager()->persist($entity); - } -} \ No newline at end of file diff --git a/old/src/PointToolsBundle/Entity/Blogs/Comment.php b/src/Entity/Blog/Comment.php similarity index 53% rename from old/src/PointToolsBundle/Entity/Blogs/Comment.php rename to src/Entity/Blog/Comment.php index 69895a2..8faedd6 100644 --- a/old/src/PointToolsBundle/Entity/Blogs/Comment.php +++ b/src/Entity/Blog/Comment.php @@ -1,106 +1,62 @@ children->removeElement($children); } - /** - * @return Comment[]|ArrayCollection - */ + /** @return ArrayCollection|self[] */ public function getChildren(): iterable { return $this->children; diff --git a/src/Repository/Blog/CommentRepository.php b/src/Repository/Blog/CommentRepository.php new file mode 100644 index 0000000..518db12 --- /dev/null +++ b/src/Repository/Blog/CommentRepository.php @@ -0,0 +1,34 @@ + + * + * @method Comment|null find($id, $lockMode = null, $lockVersion = null) + * @method Comment|null findOneBy(array $criteria, array $orderBy = null) + * @method Comment[] findAll() + * @method Comment[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class CommentRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Comment::class); + } + + public function save(Comment $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } +}