20250510#1
This commit is contained in:
@@ -10,12 +10,12 @@ Stable version
|
|||||||
composer require rmphp/storage
|
composer require rmphp/storage
|
||||||
```
|
```
|
||||||
```bash
|
```bash
|
||||||
composer require rmphp/storage:"^10.0"
|
composer require rmphp/storage:"^11.0"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Dev version contains the latest changes
|
Dev version contains the latest changes
|
||||||
|
|
||||||
```bash
|
```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 */
|
/** @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) {
|
if($result instanceof MysqlResultData) {
|
||||||
$val = (isset($function)) ? $function($result->fetchOne()) : $result->fetchOne();
|
$val = (isset($function)) ? $function($result->fetchOne()) : $result->fetchOne();
|
||||||
$out = $this->createFromData($class, $val);
|
$out = $this->createFromData($class, $val);
|
||||||
@@ -35,7 +35,7 @@ abstract class AbstractMysqlRepository extends AbstractRepository implements Mys
|
|||||||
|
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @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) {
|
if($result instanceof MysqlResultData) {
|
||||||
foreach($result->fetch() as $resultValue) {
|
foreach($result->fetch() as $resultValue) {
|
||||||
$val = (isset($function)) ? $function($resultValue) : $resultValue;
|
$val = (isset($function)) ? $function($resultValue) : $resultValue;
|
||||||
|
|||||||
@@ -16,21 +16,19 @@ interface MysqlRepositoryInterface extends RepositoryInterface {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $class
|
* @param string $class
|
||||||
* @param bool|MysqlResultData $result
|
* @param MysqlResultData|null $result
|
||||||
* @param callable|null $function
|
* @param callable|null $function
|
||||||
* @return mixed
|
* @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 string $class
|
||||||
* @param bool|MysqlResultData $result
|
* @param MysqlResultData|null $result
|
||||||
* @param callable|null $function
|
* @param callable|null $function
|
||||||
* @return array
|
* @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
|
* @param int $id
|
||||||
|
|||||||
Reference in New Issue
Block a user