From c7516deb590801184769bfb435276536368e4eaf Mon Sep 17 00:00:00 2001 From: Eric TINOCO Date: Wed, 26 Dec 2018 17:40:48 +0100 Subject: [PATCH] Add param to search with fetchall method Fix wrong call to hydrator --- src/TableGateway.php | 2 +- src/TableGatewayMapper.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/TableGateway.php b/src/TableGateway.php index 7d97de1..ad033c6 100644 --- a/src/TableGateway.php +++ b/src/TableGateway.php @@ -23,7 +23,7 @@ public function __construct($table, AdapterInterface $adapter, $features = null) { $hydratorClass = class_exists(ObjectPropertyHydrator::class) ? ObjectPropertyHydrator::class - : ObjectPropertyHydrator::class; + : ObjectProperty::class; $resultSet = new HydratingResultSet(new $hydratorClass(), new Entity()); return parent::__construct($table, $adapter, $features, $resultSet); } diff --git a/src/TableGatewayMapper.php b/src/TableGatewayMapper.php index f3d5e8a..11085a0 100644 --- a/src/TableGatewayMapper.php +++ b/src/TableGatewayMapper.php @@ -82,11 +82,12 @@ public function fetch($id) } /** + * @param array $params * @return Collection */ - public function fetchAll() + public function fetchAll($params = null) { - return new Collection(new DbTableGateway($this->table, null, ['timestamp' => 'DESC'])); + return new Collection(new DbTableGateway($this->table, $params, ['timestamp' => 'DESC'])); } /**