Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35026bb223 | ||
|
|
e2727c34e8 |
@@ -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;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ abstract class AbstractDataObject {
|
|||||||
// Если тип свойства класс (valueObject)
|
// Если тип свойства класс (valueObject)
|
||||||
elseif($property->hasType() && class_exists($property->getType()->getName())) {
|
elseif($property->hasType() && class_exists($property->getType()->getName())) {
|
||||||
// значение объект
|
// значение объект
|
||||||
if(is_object($value[$property->getName()])){
|
if(isset($value[$property->getName()]) && is_object($value[$property->getName()])){
|
||||||
$object->{$property->getName()} = $value[$property->getName()];
|
$object->{$property->getName()} = $value[$property->getName()];
|
||||||
$case[$property->getName()] = 'VO: Object';
|
$case[$property->getName()] = 'VO: Object';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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