From fa9a84f2a7a43a3b46031ece505a09a169810656 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Sun, 19 Mar 2023 17:18:19 +0300 Subject: [PATCH] Ported Blog\File entity and repo. --- .../PointToolsBundle/Entity/Blogs/File.php | 44 ------------------- .../Repository/Blogs/FileRepository.php | 14 ------ src/Entity/Blog/File.php | 37 ++++++++++++++++ src/Repository/Blog/FileRepository.php | 33 ++++++++++++++ 4 files changed, 70 insertions(+), 58 deletions(-) delete mode 100644 old/src/PointToolsBundle/Entity/Blogs/File.php delete mode 100644 old/src/PointToolsBundle/Repository/Blogs/FileRepository.php create mode 100644 src/Entity/Blog/File.php create mode 100644 src/Repository/Blog/FileRepository.php diff --git a/old/src/PointToolsBundle/Entity/Blogs/File.php b/old/src/PointToolsBundle/Entity/Blogs/File.php deleted file mode 100644 index 908b171..0000000 --- a/old/src/PointToolsBundle/Entity/Blogs/File.php +++ /dev/null @@ -1,44 +0,0 @@ -remoteUrl = $remoteUrl; - } - - public function getId(): int - { - return $this->id; - } - - public function getRemoteUrl(): string - { - return $this->remoteUrl; - } -} diff --git a/old/src/PointToolsBundle/Repository/Blogs/FileRepository.php b/old/src/PointToolsBundle/Repository/Blogs/FileRepository.php deleted file mode 100644 index a700894..0000000 --- a/old/src/PointToolsBundle/Repository/Blogs/FileRepository.php +++ /dev/null @@ -1,14 +0,0 @@ -getEntityManager()->persist($entity); - } -} diff --git a/src/Entity/Blog/File.php b/src/Entity/Blog/File.php new file mode 100644 index 0000000..0ec9f68 --- /dev/null +++ b/src/Entity/Blog/File.php @@ -0,0 +1,37 @@ +remoteUrl = $remoteUrl; + } + + public function getId(): int + { + return $this->id; + } + + public function getRemoteUrl(): string + { + return $this->remoteUrl; + } +} diff --git a/src/Repository/Blog/FileRepository.php b/src/Repository/Blog/FileRepository.php new file mode 100644 index 0000000..e342391 --- /dev/null +++ b/src/Repository/Blog/FileRepository.php @@ -0,0 +1,33 @@ + + * + * @method File|null find($id, $lockMode = null, $lockVersion = null) + * @method File|null findOneBy(array $criteria, array $orderBy = null) + * @method File[] findAll() + * @method File[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class FileRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, File::class); + } + + public function save(File $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } +}