From bcc2c609c44ad5e10d49c1a9ee8586e6673e6d58 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Sun, 19 Mar 2023 17:30:44 +0300 Subject: [PATCH] Ported Blog\PostTag entity and repo. --- .../PointToolsBundle/Entity/Blogs/PostTag.php | 79 ------------------- .../Repository/Blogs/PostTagRepository.php | 14 ---- src/Entity/Blog/PostTag.php | 62 +++++++++++++++ src/Repository/Blog/PostTagRepository.php | 33 ++++++++ 4 files changed, 95 insertions(+), 93 deletions(-) delete mode 100644 old/src/PointToolsBundle/Entity/Blogs/PostTag.php delete mode 100644 old/src/PointToolsBundle/Repository/Blogs/PostTagRepository.php create mode 100644 src/Entity/Blog/PostTag.php create mode 100644 src/Repository/Blog/PostTagRepository.php diff --git a/old/src/PointToolsBundle/Entity/Blogs/PostTag.php b/old/src/PointToolsBundle/Entity/Blogs/PostTag.php deleted file mode 100644 index 59da8f8..0000000 --- a/old/src/PointToolsBundle/Entity/Blogs/PostTag.php +++ /dev/null @@ -1,79 +0,0 @@ -post = $post; - $this->tag = $tag; - $this->text = $text; - } - - public function getId(): int - { - return $this->id; - } - - public function getText(): string - { - return $this->text; - } - - public function getOriginalTagText(): string - { - return $this->tag->getText(); - } - - public function getPost(): Post - { - return $this->post; - } - - public function getTag(): Tag - { - return $this->tag; - } -} diff --git a/old/src/PointToolsBundle/Repository/Blogs/PostTagRepository.php b/old/src/PointToolsBundle/Repository/Blogs/PostTagRepository.php deleted file mode 100644 index f5621cf..0000000 --- a/old/src/PointToolsBundle/Repository/Blogs/PostTagRepository.php +++ /dev/null @@ -1,14 +0,0 @@ -getEntityManager()->persist($entity); - } -} diff --git a/src/Entity/Blog/PostTag.php b/src/Entity/Blog/PostTag.php new file mode 100644 index 0000000..551a501 --- /dev/null +++ b/src/Entity/Blog/PostTag.php @@ -0,0 +1,62 @@ +post = $post; + $this->tag = $tag; + $this->text = $text; + } + + public function getId(): ?int + { + return $this->id; + } + + public function getText(): string + { + return $this->text; + } + + public function getOriginalTagText(): string + { + return $this->tag->getText(); + } + + public function getPost(): Post + { + return $this->post; + } + + public function getTag(): Tag + { + return $this->tag; + } +} diff --git a/src/Repository/Blog/PostTagRepository.php b/src/Repository/Blog/PostTagRepository.php new file mode 100644 index 0000000..2fc8c01 --- /dev/null +++ b/src/Repository/Blog/PostTagRepository.php @@ -0,0 +1,33 @@ + + * + * @method PostTag|null find($id, $lockMode = null, $lockVersion = null) + * @method PostTag|null findOneBy(array $criteria, array $orderBy = null) + * @method PostTag[] findAll() + * @method PostTag[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class PostTagRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, PostTag::class); + } + + public function save(PostTag $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } +}