Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2727c34e8 |
@@ -10,12 +10,12 @@ Stable version
|
||||
composer require rmphp/storage
|
||||
```
|
||||
```bash
|
||||
composer require rmphp/storage:"^10.0"
|
||||
composer require rmphp/storage:"^11.0"
|
||||
```
|
||||
|
||||
|
||||
Dev version contains the latest changes
|
||||
|
||||
```bash
|
||||
composer require rmphp/storage:"10.x-dev"
|
||||
composer require rmphp/storage:"11.x-dev"
|
||||
```
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class AbstractMysqlRepository extends AbstractRepository implements Mys
|
||||
|
||||
|
||||
/** @inheritDoc */
|
||||
public function createFromResult(string $class, bool|MysqlResultData $result, callable $function = null): mixed {
|
||||
public function createFromResult(string $class, ?MysqlResultData $result, callable $function = null): mixed {
|
||||
if($result instanceof MysqlResultData) {
|
||||
$val = (isset($function)) ? $function($result->fetchOne()) : $result->fetchOne();
|
||||
$out = $this->createFromData($class, $val);
|
||||
@@ -35,7 +35,7 @@ abstract class AbstractMysqlRepository extends AbstractRepository implements Mys
|
||||
|
||||
|
||||
/** @inheritDoc */
|
||||
public function createListFromResult(string $class, bool|MysqlResultData $result, callable $function = null): array {
|
||||
public function createListFromResult(string $class, ?MysqlResultData $result, callable $function = null): array {
|
||||
if($result instanceof MysqlResultData) {
|
||||
foreach($result->fetch() as $resultValue) {
|
||||
$val = (isset($function)) ? $function($resultValue) : $resultValue;
|
||||
|
||||
@@ -16,21 +16,19 @@ interface MysqlRepositoryInterface extends RepositoryInterface {
|
||||
|
||||
/**
|
||||
* @param string $class
|
||||
* @param bool|MysqlResultData $result
|
||||
* @param MysqlResultData|null $result
|
||||
* @param callable|null $function
|
||||
* @return mixed
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
public function createFromResult(string $class, bool|MysqlResultData $result, callable $function = null): mixed;
|
||||
public function createFromResult(string $class, ?MysqlResultData $result, callable $function = null): mixed;
|
||||
|
||||
/**
|
||||
* @param string $class
|
||||
* @param bool|MysqlResultData $result
|
||||
* @param MysqlResultData|null $result
|
||||
* @param callable|null $function
|
||||
* @return array
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
public function createListFromResult(string $class, bool|MysqlResultData $result, callable $function = null): array;
|
||||
public function createListFromResult(string $class, ?MysqlResultData $result, callable $function = null): array;
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
|
||||
Reference in New Issue
Block a user