From 8c02846dfa602275a50bf63537be8a1cce09e64b Mon Sep 17 00:00:00 2001 From: Ludovic Janot Date: Mon, 28 Jun 2021 11:17:11 +0200 Subject: [PATCH 1/2] Remove usage of Timber\PostCollection in Repository - See gihub issues #53 & #54 --- .../app/Repositories/Repository.php | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php b/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php index 2cb59d8..baa6a29 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php @@ -8,8 +8,6 @@ namespace Studiometa\Repositories; -use Timber\PostCollection; - /** Class */ abstract class Repository { /** @@ -39,28 +37,6 @@ public function first() { return isset( $local_array[0] ) ? $local_array[0] : null; } - /** - * Returns a slice of the collection starting at the given index. - * Similar to Laravel's slice(). - * - * @param int $start Start index. - * - * @return array - */ - public function slice( $start ) { - $local_array = $this->get(); - - if ( count( $local_array ) < 1 ) { - return array(); - } - - if ( is_object( $local_array ) && $local_array instanceof PostCollection ) { - $local_array = $local_array->getArrayCopy(); - } - - return array_slice( $local_array, (int) $start ); - } - /** * Runs a query. * From 0abde0d71bef9b84c162df86e96a13cfe0b4ffaf Mon Sep 17 00:00:00 2001 From: Ludovic Janot Date: Mon, 5 Jul 2021 10:58:20 +0200 Subject: [PATCH 2/2] Update Docblock comments --- .../<%= slug %>/app/Repositories/Repository.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php b/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php index baa6a29..92e78b0 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php @@ -1,7 +1,7 @@ result_set; @@ -73,6 +73,8 @@ protected function query( array $params ) { * * @param array $params Query params. * @return mixed + * + * @example ./app/Repositories/PostRepository.php How to implement do_query(). */ abstract protected function do_query( $params ); @@ -89,7 +91,7 @@ protected function reset() { /** * Returns current result set * - * @param array|PostCollection $result_set Result set. + * @param array $result_set Result set. * * @return Repository */