aboutsummaryrefslogtreecommitdiffstats
path: root/core/namespace/ORM/Repositories
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-07-22 21:36:42 +0200
committerThomas Lange <code@nerdmind.de>2021-07-22 21:43:00 +0200
commit8662f123d781a6df4eb5bd05b3556cca94fcf334 (patch)
treee5da1e3c347e59be72e704450687548a023035cd /core/namespace/ORM/Repositories
parent0db1beaea6b849790aa0f1f4ecbf6439ce4f1104 (diff)
downloadblog-8662f123d781a6df4eb5bd05b3556cca94fcf334.tar.gz
blog-8662f123d781a6df4eb5bd05b3556cca94fcf334.tar.xz
blog-8662f123d781a6df4eb5bd05b3556cca94fcf334.zip
Move repository search functionality into a trait
Move the methods for the search functionality of the abstract Repository class into a separate trait and use it in the Page and Post repository. The reason because of this is that only the Page and Post repositories having a search functionality, while the other repositories have not.
Diffstat (limited to 'core/namespace/ORM/Repositories')
-rw-r--r--core/namespace/ORM/Repositories/PageRepository.php3
-rw-r--r--core/namespace/ORM/Repositories/PostRepository.php3
2 files changed, 6 insertions, 0 deletions
diff --git a/core/namespace/ORM/Repositories/PageRepository.php b/core/namespace/ORM/Repositories/PageRepository.php
index 8c7c94b..993fb67 100644
--- a/core/namespace/ORM/Repositories/PageRepository.php
+++ b/core/namespace/ORM/Repositories/PageRepository.php
@@ -1,8 +1,11 @@
<?php
namespace ORM\Repositories;
use ORM\Repository;
+use ORM\RepositorySearch;
class PageRepository extends Repository {
+ use RepositorySearch;
+
public static function getTableName(): string { return 'page'; }
public static function getClassName(): string { return 'ORM\Entities\Page'; }
}
diff --git a/core/namespace/ORM/Repositories/PostRepository.php b/core/namespace/ORM/Repositories/PostRepository.php
index 400d596..24ab47f 100644
--- a/core/namespace/ORM/Repositories/PostRepository.php
+++ b/core/namespace/ORM/Repositories/PostRepository.php
@@ -1,8 +1,11 @@
<?php
namespace ORM\Repositories;
use ORM\Repository;
+use ORM\RepositorySearch;
class PostRepository extends Repository {
+ use RepositorySearch;
+
public static function getTableName(): string { return 'post'; }
public static function getClassName(): string { return 'ORM\Entities\Post'; }
}