Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aba089db5e | ||
|
|
43e529dcad | ||
|
|
5bef4f577e | ||
|
|
b53c3f9815 |
@@ -9,5 +9,5 @@ composer create-project rmphp/skeleton project-name
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer create-project rmphp/skeleton:"^4.2" project-name
|
composer create-project rmphp/skeleton:"^4.4" project-name
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -6,6 +6,27 @@ use ReflectionClass;
|
|||||||
|
|
||||||
abstract class AbstractDTO {
|
abstract class AbstractDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param object $data
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
static function fromObject(object $data) : static {
|
||||||
|
return static::fromArray(get_object_vars($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array|object ...$data
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
static function fromData(array|object ...$data) : static {
|
||||||
|
$array = array_map(function($item) {
|
||||||
|
return (is_object($item)) ? get_object_vars($item) : $item;
|
||||||
|
}, $data);
|
||||||
|
return static::fromArray(array_merge(...$array));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return static
|
* @return static
|
||||||
@@ -24,4 +45,5 @@ abstract class AbstractDTO {
|
|||||||
}
|
}
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Rmphp\Cache\Cache;
|
|
||||||
use Rmphp\Cache\CacheInterface;
|
|
||||||
use Rmphp\Storage\Mysql\MysqlStorage;
|
use Rmphp\Storage\Mysql\MysqlStorage;
|
||||||
use Rmphp\Storage\Mysql\MysqlStorageInterface;
|
use Rmphp\Storage\Mysql\MysqlStorageInterface;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
MysqlStorageInterface::class => DI\create(MysqlStorage::class)->constructor(json_decode(getenv("MYSQL_PARAM"), true)),
|
MysqlStorageInterface::class => DI\create(MysqlStorage::class)->constructor(json_decode(getenv("MYSQL_PARAM"), true)),
|
||||||
CacheInterface::class => DI\create(Cache::class)->constructor("../var/cache"),
|
'App\Domain\Repository\*RepositoryInterface' => DI\autowire('App\Infrastructure\Repository\*Repository'),
|
||||||
'App\*\Domain\Repository\*RepositoryInterface' => DI\autowire('App\*\Infrastructure\Repository\*Repository'),
|
'App\*\Domain\Repository\*RepositoryInterface' => DI\autowire('App\*\Infrastructure\Repository\*Repository'),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
"rmphp/content": "^3.1",
|
"rmphp/content": "^3.1",
|
||||||
"rmphp/kernel": "^5.0",
|
"rmphp/kernel": "^5.0",
|
||||||
"rmphp/router": "^1.2",
|
"rmphp/router": "^1.2",
|
||||||
"rmphp/session": "^1.0",
|
"rmphp/session": "^1.1",
|
||||||
"rmphp/redis": "^1.0",
|
"rmphp/redis": "^1.0",
|
||||||
"rmphp/storage": "^4.0",
|
"rmphp/storage": "^6.0",
|
||||||
"symfony/dotenv": "^6.2"
|
"symfony/dotenv": "^6.2"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
|||||||
Reference in New Issue
Block a user