first version
This commit is contained in:
parent
c0c461a844
commit
6e01f77488
@ -1,10 +1,10 @@
|
||||
# DB Configuration
|
||||
DB_DRIVER=pdo_mysql
|
||||
DB_HOST=homepage-backend-mysql
|
||||
DB_HOST=template-backend-mysql
|
||||
DB_PORT=3306
|
||||
DB_USER=homepage
|
||||
DB_USER=template
|
||||
DB_PASSWORD=pass
|
||||
DB_NAME=homepage
|
||||
DB_NAME=template
|
||||
DB_NAME_LOG=log
|
||||
|
||||
# API Keys
|
||||
@ -14,7 +14,7 @@ FILE_API_KEY=
|
||||
HOMEPAGE_API_KEY=
|
||||
BEE_API_KEY=
|
||||
|
||||
# Homepage Setup
|
||||
# Template Setup
|
||||
INIT_USER_NAME=admin
|
||||
INIT_USER_PASSWORD=password
|
||||
INIT_USER_MAIL=admin@test.com
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Homepage\Infrastructure\Logging\Logger\Logger;
|
||||
use Template\Infrastructure\Logging\Logger\Logger;
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
require_once __DIR__ . '/../config/autoload/defines.php';
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
require_once __DIR__ . '/../config/autoload/defines.php';
|
||||
require APP_ROOT . '/vendor/autoload.php';
|
||||
|
||||
use Homepage\Data\Business\Manager\HomepageEntityManager;
|
||||
use Template\Data\Business\Manager\TemplateEntityManager;
|
||||
use Doctrine\Common\Annotations\AnnotationReader;
|
||||
use Doctrine\DBAL\DriverManager;
|
||||
use Doctrine\Migrations\Configuration\Configuration;
|
||||
@ -40,7 +40,7 @@ $driver = new AnnotationDriver($reader, $paths);
|
||||
|
||||
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
|
||||
$config->setMetadataDriverImpl($driver);
|
||||
$entityManager = $container->get(HomepageEntityManager::class);
|
||||
$entityManager = $container->get(TemplateEntityManager::class);
|
||||
|
||||
try {
|
||||
$connection = DriverManager::getConnection($dbParams);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
require_once __DIR__ . '/../config/autoload/defines.php';
|
||||
require APP_ROOT . '/vendor/autoload.php';
|
||||
|
||||
use Homepage\Data\Business\Manager\HomepageEntityManager;
|
||||
use Template\Data\Business\Manager\TemplateEntityManager;
|
||||
use Doctrine\Common\Annotations\AnnotationReader;
|
||||
use Doctrine\DBAL\DriverManager;
|
||||
use Doctrine\Migrations\Configuration\Configuration;
|
||||
@ -30,17 +30,17 @@ $isDevMode = true;
|
||||
$container = require APP_ROOT . '/config/container.php';
|
||||
$config = $container->get('config');
|
||||
$doctrineConfig = $config['doctrine'];
|
||||
$paths = $doctrineConfig['driver']['orm_homepage_annotation_driver']['paths'];
|
||||
$paths = $doctrineConfig['driver']['orm_template_annotation_driver']['paths'];
|
||||
|
||||
$dbParams = $doctrineConfig['connection']['orm_homepage']['params'];
|
||||
$migrationsConf = $doctrineConfig['migrations_configuration']['orm_homepage'];
|
||||
$dbParams = $doctrineConfig['connection']['orm_template']['params'];
|
||||
$migrationsConf = $doctrineConfig['migrations_configuration']['orm_template'];
|
||||
|
||||
$reader = new AnnotationReader();
|
||||
$driver = new AnnotationDriver($reader, $paths);
|
||||
|
||||
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
|
||||
$config->setMetadataDriverImpl($driver);
|
||||
$entityManager = $container->get(HomepageEntityManager::class);
|
||||
$entityManager = $container->get(TemplateEntityManager::class);
|
||||
|
||||
try {
|
||||
$connection = DriverManager::getConnection($dbParams);
|
||||
|
||||
@ -21,12 +21,12 @@ $SCRIPT_DIR/exec up -d
|
||||
source $ENV_DIR/bin/script/drun
|
||||
|
||||
# Install PHP packages
|
||||
drun homepage-backend composer install
|
||||
drun template-backend composer install
|
||||
|
||||
# Migrate databases to current version
|
||||
drun homepage-backend composer dmm
|
||||
drun homepage-backend composer dmlm
|
||||
drun template-backend composer dmm
|
||||
drun template-backend composer dmlm
|
||||
|
||||
# Insert setup for project after this line
|
||||
drun homepage-backend composer console rbac:update
|
||||
drun homepage-backend composer console init:data
|
||||
drun template-backend composer console rbac:update
|
||||
drun template-backend composer console init:data
|
||||
@ -23,46 +23,46 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Homepage\\API\\Console\\": "src\/ApiDomain\/Console\/src",
|
||||
"Homepage\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src",
|
||||
"Homepage\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src",
|
||||
"Homepage\\API\\External\\Product\\": "src\/ApiDomain\/External\/Product\/src",
|
||||
"Homepage\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src",
|
||||
"Homepage\\Data\\Business\\": "src\/DataDomain\/Business\/src",
|
||||
"Homepage\\Data\\Log\\": "src\/DataDomain\/Log\/src",
|
||||
"Homepage\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src",
|
||||
"Homepage\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src",
|
||||
"Homepage\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src",
|
||||
"Homepage\\Handling\\User\\": "src\/HandlingDomain\/User\/src",
|
||||
"Homepage\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src",
|
||||
"Homepage\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src",
|
||||
"Homepage\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src",
|
||||
"Homepage\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src",
|
||||
"Homepage\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src",
|
||||
"Homepage\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src",
|
||||
"Homepage\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src",
|
||||
"Homepage\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src",
|
||||
"Homepage\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src",
|
||||
"Homepage\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src",
|
||||
"Homepage\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src"
|
||||
"Template\\API\\Console\\": "src\/ApiDomain\/Console\/src",
|
||||
"Template\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src",
|
||||
"Template\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src",
|
||||
"Template\\API\\External\\Product\\": "src\/ApiDomain\/External\/Product\/src",
|
||||
"Template\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src",
|
||||
"Template\\Data\\Business\\": "src\/DataDomain\/Business\/src",
|
||||
"Template\\Data\\Log\\": "src\/DataDomain\/Log\/src",
|
||||
"Template\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src",
|
||||
"Template\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src",
|
||||
"Template\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src",
|
||||
"Template\\Handling\\User\\": "src\/HandlingDomain\/User\/src",
|
||||
"Template\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src",
|
||||
"Template\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src",
|
||||
"Template\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src",
|
||||
"Template\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src",
|
||||
"Template\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src",
|
||||
"Template\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src",
|
||||
"Template\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src",
|
||||
"Template\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src",
|
||||
"Template\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src",
|
||||
"Template\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src",
|
||||
"Template\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"teewurst\/psr4-advanced-wildcard-composer-plugin": {
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Homepage\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/",
|
||||
"Homepage\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/",
|
||||
"Homepage\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/",
|
||||
"Homepage\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/"
|
||||
"Template\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/",
|
||||
"Template\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/",
|
||||
"Template\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/",
|
||||
"Template\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Homepage\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/",
|
||||
"Homepage\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/",
|
||||
"Homepage\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/",
|
||||
"Homepage\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/"
|
||||
"Template\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/",
|
||||
"Template\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/",
|
||||
"Template\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/",
|
||||
"Template\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,27 +96,27 @@
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Homepage\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src",
|
||||
"Homepage\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src",
|
||||
"Homepage\\API\\External\\Product\\": "src\/ApiDomain\/External\/Product\/src",
|
||||
"Homepage\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src",
|
||||
"Homepage\\Data\\Business\\": "src\/DataDomain\/Business\/src",
|
||||
"Homepage\\Data\\Log\\": "src\/DataDomain\/Log\/src",
|
||||
"Homepage\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src",
|
||||
"Homepage\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src",
|
||||
"Homepage\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src",
|
||||
"Homepage\\Handling\\User\\": "src\/HandlingDomain\/User\/src",
|
||||
"Homepage\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src",
|
||||
"Homepage\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src",
|
||||
"Homepage\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src",
|
||||
"Homepage\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src",
|
||||
"Homepage\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src",
|
||||
"Homepage\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src",
|
||||
"Homepage\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src",
|
||||
"Homepage\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src",
|
||||
"Homepage\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src",
|
||||
"Homepage\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src",
|
||||
"Homepage\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src"
|
||||
"Template\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src",
|
||||
"Template\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src",
|
||||
"Template\\API\\External\\Product\\": "src\/ApiDomain\/External\/Product\/src",
|
||||
"Template\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src",
|
||||
"Template\\Data\\Business\\": "src\/DataDomain\/Business\/src",
|
||||
"Template\\Data\\Log\\": "src\/DataDomain\/Log\/src",
|
||||
"Template\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src",
|
||||
"Template\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src",
|
||||
"Template\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src",
|
||||
"Template\\Handling\\User\\": "src\/HandlingDomain\/User\/src",
|
||||
"Template\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src",
|
||||
"Template\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src",
|
||||
"Template\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src",
|
||||
"Template\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src",
|
||||
"Template\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src",
|
||||
"Template\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src",
|
||||
"Template\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src",
|
||||
"Template\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src",
|
||||
"Template\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src",
|
||||
"Template\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src",
|
||||
"Template\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -23,25 +23,25 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Homepage\\API\\Console\\": "src/ApiDomain/Console/src/"
|
||||
"Template\\API\\Console\\": "src/ApiDomain/Console/src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"teewurst/psr4-advanced-wildcard-composer-plugin": {
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Homepage\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/",
|
||||
"Homepage\\Data\\%s\\": "src/DataDomain/{*}/src/",
|
||||
"Homepage\\Handling\\%s\\": "src/HandlingDomain/{*}/src/",
|
||||
"Homepage\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/"
|
||||
"Template\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/",
|
||||
"Template\\Data\\%s\\": "src/DataDomain/{*}/src/",
|
||||
"Template\\Handling\\%s\\": "src/HandlingDomain/{*}/src/",
|
||||
"Template\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Homepage\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/",
|
||||
"Homepage\\Data\\%s\\": "src/DataDomain/{*}/src/",
|
||||
"Homepage\\Handling\\%s\\": "src/HandlingDomain/{*}/src/",
|
||||
"Homepage\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/"
|
||||
"Template\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/",
|
||||
"Template\\Data\\%s\\": "src/DataDomain/{*}/src/",
|
||||
"Template\\Handling\\%s\\": "src/HandlingDomain/{*}/src/",
|
||||
"Template\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,13 +3,13 @@
|
||||
return [
|
||||
'api' => [
|
||||
'keys' => [
|
||||
'homepage' => $_ENV['HOMEPAGE_API_KEY'],
|
||||
'template' => $_ENV['HOMEPAGE_API_KEY'],
|
||||
'notification' => $_ENV['NOTIFICATION_API_KEY'],
|
||||
],
|
||||
|
||||
'services' => [
|
||||
'homepage' => [
|
||||
'host' => 'homepage-backend-nginx',
|
||||
'template' => [
|
||||
'host' => 'template-backend-nginx',
|
||||
'apis' => [
|
||||
|
||||
]
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'homepage-rbac' => [
|
||||
'template-rbac' => [
|
||||
'roles' => [
|
||||
'admin',
|
||||
'user',
|
||||
|
||||
@ -6,8 +6,8 @@ use Monolog\Level;
|
||||
|
||||
return [
|
||||
'logger' => [
|
||||
'name' => 'homepage.backend',
|
||||
'path' => APP_ROOT . '/var/log/homepage.backend.log',
|
||||
'name' => 'template.backend',
|
||||
'path' => APP_ROOT . '/var/log/template.backend.log',
|
||||
'level' => Level::Debug,
|
||||
'pretty' => true,
|
||||
]
|
||||
|
||||
@ -40,34 +40,34 @@ $aggregator = new ConfigAggregator([
|
||||
|
||||
|
||||
// Data
|
||||
\Homepage\Data\Business\ConfigProvider::class,
|
||||
\Homepage\Data\Log\ConfigProvider::class,
|
||||
\Template\Data\Business\ConfigProvider::class,
|
||||
\Template\Data\Log\ConfigProvider::class,
|
||||
|
||||
// Infrastructure
|
||||
\Homepage\Infrastructure\Database\ConfigProvider::class,
|
||||
\Homepage\Infrastructure\DependencyInjection\ConfigProvider::class,
|
||||
\Homepage\Infrastructure\Encryption\ConfigProvider::class,
|
||||
\Homepage\Infrastructure\Exception\ConfigProvider::class,
|
||||
\Homepage\Infrastructure\Logging\ConfigProvider::class,
|
||||
\Homepage\Infrastructure\Rbac\ConfigProvider::class,
|
||||
\Homepage\Infrastructure\Request\ConfigProvider::class,
|
||||
\Homepage\Infrastructure\Session\ConfigProvider::class,
|
||||
\Template\Infrastructure\Database\ConfigProvider::class,
|
||||
\Template\Infrastructure\DependencyInjection\ConfigProvider::class,
|
||||
\Template\Infrastructure\Encryption\ConfigProvider::class,
|
||||
\Template\Infrastructure\Exception\ConfigProvider::class,
|
||||
\Template\Infrastructure\Logging\ConfigProvider::class,
|
||||
\Template\Infrastructure\Rbac\ConfigProvider::class,
|
||||
\Template\Infrastructure\Request\ConfigProvider::class,
|
||||
\Template\Infrastructure\Session\ConfigProvider::class,
|
||||
|
||||
// HandlingDomain
|
||||
\Homepage\Handling\Product\ConfigProvider::class,
|
||||
\Homepage\Handling\User\ConfigProvider::class,
|
||||
\Homepage\Handling\UserSession\ConfigProvider::class,
|
||||
\Homepage\Handling\Registration\ConfigProvider::class,
|
||||
\Template\Handling\Product\ConfigProvider::class,
|
||||
\Template\Handling\User\ConfigProvider::class,
|
||||
\Template\Handling\UserSession\ConfigProvider::class,
|
||||
\Template\Handling\Registration\ConfigProvider::class,
|
||||
|
||||
// API
|
||||
/// Command
|
||||
\Homepage\API\Console\ConfigProvider::class,
|
||||
\Template\API\Console\ConfigProvider::class,
|
||||
|
||||
/// External
|
||||
\Homepage\API\External\Health\ConfigProvider::class,
|
||||
\Homepage\API\External\Product\ConfigProvider::class,
|
||||
\Homepage\API\External\User\ConfigProvider::class,
|
||||
\Homepage\API\External\Authentication\ConfigProvider::class,
|
||||
\Template\API\External\Health\ConfigProvider::class,
|
||||
\Template\API\External\Product\ConfigProvider::class,
|
||||
\Template\API\External\User\ConfigProvider::class,
|
||||
\Template\API\External\Authentication\ConfigProvider::class,
|
||||
|
||||
/// Internal
|
||||
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Homepage\Infrastructure\Exception\Middleware\HomepageExceptionHandlerMiddleware;
|
||||
use Homepage\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware;
|
||||
use Homepage\Infrastructure\Session\Middleware\SessionMiddleware;
|
||||
use Template\Infrastructure\Exception\Middleware\TemplateExceptionHandlerMiddleware;
|
||||
use Template\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware;
|
||||
use Template\Infrastructure\Session\Middleware\SessionMiddleware;
|
||||
use Laminas\Stratigility\Middleware\ErrorHandler;
|
||||
use Mezzio\Application;
|
||||
use Mezzio\Handler\NotFoundHandler;
|
||||
@ -66,11 +66,11 @@ return function (Application $app, MiddlewareFactory $factory, ContainerInterfac
|
||||
|
||||
|
||||
|
||||
//// Pre Homepage Space
|
||||
$app->pipe(HomepageExceptionHandlerMiddleware::class);
|
||||
//// Pre Template Space
|
||||
$app->pipe(TemplateExceptionHandlerMiddleware::class);
|
||||
$app->pipe(AnalyzeHeaderMiddleware::class);
|
||||
|
||||
//// Homepage Space
|
||||
//// Template Space
|
||||
$app->pipe(SessionMiddleware::class);
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
use Mezzio\Application;
|
||||
use Mezzio\MiddlewareFactory;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Homepage\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
|
||||
use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
|
||||
|
||||
/**
|
||||
* laminas-router route configuration
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Migrations\Homepage;
|
||||
namespace Template\Migrations\Template;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Migrations\Homepage;
|
||||
namespace Template\Migrations\Template;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Migrations\Homepage;
|
||||
namespace Template\Migrations\Template;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Migrations\Homepage;
|
||||
namespace Template\Migrations\Template;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Migrations\Homepage;
|
||||
namespace Template\Migrations\Template;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Migrations\Homepage;
|
||||
namespace Template\Migrations\Template;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Migrations\Homepage;
|
||||
namespace Template\Migrations\Template;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Migrations\Homepage;
|
||||
namespace Template\Migrations\Template;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Migrations\Homepage;
|
||||
namespace Template\Migrations\Template;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Migrations\Log;
|
||||
namespace Template\Migrations\Log;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
version: '3'
|
||||
networks:
|
||||
homepage:
|
||||
template:
|
||||
external: true
|
||||
|
||||
services:
|
||||
homepage-backend-mysql:
|
||||
image: homepage-backend-mysql
|
||||
template-backend-mysql:
|
||||
image: template-backend-mysql
|
||||
networks:
|
||||
- homepage
|
||||
- template
|
||||
build:
|
||||
context: ./../
|
||||
dockerfile: ./docker/mysql/dockerfile
|
||||
volumes:
|
||||
- /Users/flo/dev/backend/homepage/var/db:/var/lib/mysql:z
|
||||
- /Users/flo/dev/backend/template/var/db:/var/lib/mysql:z
|
||||
environment:
|
||||
MYSQL_USER: ${DB_USER}
|
||||
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||
@ -23,29 +23,29 @@ services:
|
||||
timeout: 20s
|
||||
retries: 10
|
||||
|
||||
homepage-backend-app:
|
||||
image: homepage-backend-app
|
||||
template-backend-app:
|
||||
image: template-backend-app
|
||||
networks:
|
||||
- homepage
|
||||
- template
|
||||
build:
|
||||
context: ./../
|
||||
dockerfile: ./docker/php/dockerfile
|
||||
volumes:
|
||||
- /Users/flo/dev/backend/homepage/:/var/www/html:z
|
||||
- /Users/flo/dev/backend/template/:/var/www/html:z
|
||||
ports:
|
||||
- 9000:9000
|
||||
depends_on:
|
||||
homepage-backend-mysql:
|
||||
template-backend-mysql:
|
||||
condition: service_healthy
|
||||
|
||||
homepage-backend-nginx:
|
||||
image: homepage-backend-nginx
|
||||
template-backend-nginx:
|
||||
image: template-backend-nginx
|
||||
networks:
|
||||
- homepage
|
||||
- template
|
||||
build:
|
||||
context: ./../
|
||||
dockerfile: ./docker/nginx/dockerfile
|
||||
ports:
|
||||
- 8080:80
|
||||
depends_on:
|
||||
- homepage-backend-app
|
||||
- template-backend-app
|
||||
@ -1,13 +1,13 @@
|
||||
version: '3'
|
||||
networks:
|
||||
homepage:
|
||||
template:
|
||||
external: true
|
||||
|
||||
services:
|
||||
homepage-backend-mysql:
|
||||
image: homepage-backend-mysql
|
||||
template-backend-mysql:
|
||||
image: template-backend-mysql
|
||||
networks:
|
||||
- homepage
|
||||
- template
|
||||
build:
|
||||
context: ./../
|
||||
dockerfile: ./docker/mysql/dockerfile
|
||||
@ -23,10 +23,10 @@ services:
|
||||
timeout: 20s
|
||||
retries: 10
|
||||
|
||||
homepage-backend-app:
|
||||
image: homepage-backend-app
|
||||
template-backend-app:
|
||||
image: template-backend-app
|
||||
networks:
|
||||
- homepage
|
||||
- template
|
||||
build:
|
||||
context: ./../
|
||||
dockerfile: ./docker/php/dockerfile
|
||||
@ -35,17 +35,17 @@ services:
|
||||
ports:
|
||||
- 9000:9000
|
||||
depends_on:
|
||||
homepage-backend-mysql:
|
||||
template-backend-mysql:
|
||||
condition: service_healthy
|
||||
|
||||
homepage-backend-nginx:
|
||||
image: homepage-backend-nginx
|
||||
template-backend-nginx:
|
||||
image: template-backend-nginx
|
||||
networks:
|
||||
- homepage
|
||||
- template
|
||||
build:
|
||||
context: ./../
|
||||
dockerfile: ./docker/nginx/dockerfile
|
||||
ports:
|
||||
- 8080:80
|
||||
depends_on:
|
||||
- homepage-backend-app
|
||||
- template-backend-app
|
||||
@ -1,4 +1,4 @@
|
||||
CREATE DATABASE IF NOT EXISTS `log`;
|
||||
CREATE DATABASE IF NOT EXISTS `homepage`;
|
||||
CREATE DATABASE IF NOT EXISTS `template`;
|
||||
|
||||
GRANT ALL PRIVILEGES on *.* to 'homepage'@'%';
|
||||
GRANT ALL PRIVILEGES on *.* to 'template'@'%';
|
||||
@ -1,5 +1,5 @@
|
||||
upstream host-backend-app {
|
||||
server homepage-backend-app:9000;
|
||||
server template-backend-app:9000;
|
||||
}
|
||||
|
||||
server {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Homepage\API\Console\Command\InitializeDataCommand;
|
||||
use Homepage\API\Console\Command\RbacUpdateCommand;
|
||||
use Template\API\Console\Command\InitializeDataCommand;
|
||||
use Template\API\Console\Command\RbacUpdateCommand;
|
||||
|
||||
return [
|
||||
'commands' => [
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Homepage\API\Console\Command\InitializeDataCommand;
|
||||
use Homepage\API\Console\Command\RbacUpdateCommand;
|
||||
use Template\API\Console\Command\InitializeDataCommand;
|
||||
use Template\API\Console\Command\RbacUpdateCommand;
|
||||
use Reinfi\DependencyInjection\Factory\AutoWiringFactory;
|
||||
|
||||
return [
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\API\Console\Command;
|
||||
namespace Template\API\Console\Command;
|
||||
|
||||
use Homepage\Data\Business\Entity\Role;
|
||||
use Homepage\Data\Business\Entity\User;
|
||||
use Homepage\Data\Business\Repository\RoleRepository;
|
||||
use Homepage\Data\Business\Repository\UserRepository;
|
||||
use Homepage\Data\Business\Manager\HomepageEntityManager;
|
||||
use Homepage\Infrastructure\Encryption\Client\EncryptionClient;
|
||||
use Homepage\Infrastructure\Logging\Logger\Logger;
|
||||
use Template\Data\Business\Entity\Role;
|
||||
use Template\Data\Business\Entity\User;
|
||||
use Template\Data\Business\Repository\RoleRepository;
|
||||
use Template\Data\Business\Repository\UserRepository;
|
||||
use Template\Data\Business\Manager\TemplateEntityManager;
|
||||
use Template\Infrastructure\Encryption\Client\EncryptionClient;
|
||||
use Template\Infrastructure\Logging\Logger\Logger;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
@ -23,7 +23,7 @@ class InitializeDataCommand extends Command
|
||||
|
||||
public function __construct(
|
||||
private readonly EncryptionClient $encryptionClient,
|
||||
private readonly HomepageEntityManager $entityManager,
|
||||
private readonly TemplateEntityManager $entityManager,
|
||||
private readonly Logger $logger,
|
||||
) {
|
||||
parent::__construct($this->getName());
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\API\Console\Command;
|
||||
namespace Template\API\Console\Command;
|
||||
|
||||
use Homepage\Data\Business\Entity\Permission;
|
||||
use Homepage\Data\Business\Entity\Role;
|
||||
use Homepage\Data\Business\Repository\PermissionRepository;
|
||||
use Homepage\Data\Business\Repository\RoleRepository;
|
||||
use Homepage\Data\Business\Manager\HomepageEntityManager;
|
||||
use Homepage\Infrastructure\Logging\Logger\Logger;
|
||||
use Template\Data\Business\Entity\Permission;
|
||||
use Template\Data\Business\Entity\Role;
|
||||
use Template\Data\Business\Repository\PermissionRepository;
|
||||
use Template\Data\Business\Repository\RoleRepository;
|
||||
use Template\Data\Business\Manager\TemplateEntityManager;
|
||||
use Template\Infrastructure\Logging\Logger\Logger;
|
||||
use Reinfi\DependencyInjection\Service\ConfigService;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
@ -24,7 +24,7 @@ class RbacUpdateCommand extends Command
|
||||
|
||||
public function __construct(
|
||||
private readonly ConfigService $configService,
|
||||
private readonly HomepageEntityManager $entityManager,
|
||||
private readonly TemplateEntityManager $entityManager,
|
||||
private readonly Logger $logger,
|
||||
) {
|
||||
parent::__construct($this->getName());
|
||||
@ -32,7 +32,7 @@ class RbacUpdateCommand extends Command
|
||||
$this->roleRepository = $this->entityManager->getRepository(Role::class);
|
||||
$this->permissionRepository = $this->entityManager->getRepository(Permission::class);
|
||||
|
||||
$this->rbacConfig = $this->configService->resolve('homepage-rbac')->toArray();
|
||||
$this->rbacConfig = $this->configService->resolve('template-rbac')->toArray();
|
||||
}
|
||||
|
||||
protected function execute(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\Console;
|
||||
namespace Template\API\Console;
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Homepage\API\External\Authentication\Handler\ConfirmRegistrationHandler;
|
||||
use Homepage\API\External\Authentication\Handler\LoginUserHandler;
|
||||
use Homepage\API\External\Authentication\Handler\LogoutUserHandler;
|
||||
use Homepage\API\External\Authentication\Handler\RegisterUserHandler;
|
||||
use Homepage\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
|
||||
use Template\API\External\Authentication\Handler\ConfirmRegistrationHandler;
|
||||
use Template\API\External\Authentication\Handler\LoginUserHandler;
|
||||
use Template\API\External\Authentication\Handler\LogoutUserHandler;
|
||||
use Template\API\External\Authentication\Handler\RegisterUserHandler;
|
||||
use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
|
||||
|
||||
return [
|
||||
[
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Homepage\API\External\Authentication\Handler\ConfirmRegistrationHandler;
|
||||
use Homepage\API\External\Authentication\Handler\LoginUserHandler;
|
||||
use Homepage\API\External\Authentication\Handler\LogoutUserHandler;
|
||||
use Homepage\API\External\Authentication\Handler\RegisterUserHandler;
|
||||
use Template\API\External\Authentication\Handler\ConfirmRegistrationHandler;
|
||||
use Template\API\External\Authentication\Handler\LoginUserHandler;
|
||||
use Template\API\External\Authentication\Handler\LogoutUserHandler;
|
||||
use Template\API\External\Authentication\Handler\RegisterUserHandler;
|
||||
use Reinfi\DependencyInjection\Factory\AutoWiringFactory;
|
||||
|
||||
return [
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\Authentication;
|
||||
namespace Template\API\External\Authentication;
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
|
||||
@ -2,12 +2,12 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\Authentication\Handler;
|
||||
namespace Template\API\External\Authentication\Handler;
|
||||
|
||||
use Homepage\API\External\User\Formatter\UserFormatter;
|
||||
use Homepage\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandBuilder;
|
||||
use Homepage\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandHandler;
|
||||
use Homepage\Infrastructure\Session\Middleware\SessionMiddleware;
|
||||
use Template\API\External\User\Formatter\UserFormatter;
|
||||
use Template\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandBuilder;
|
||||
use Template\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandHandler;
|
||||
use Template\Infrastructure\Session\Middleware\SessionMiddleware;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
@ -2,11 +2,11 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\Authentication\Handler;
|
||||
namespace Template\API\External\Authentication\Handler;
|
||||
|
||||
use Homepage\Handling\UserSession\Handler\Command\LoginUser\LoginUserCommandBuilder;
|
||||
use Homepage\Handling\UserSession\Handler\Command\LoginUser\LoginUserCommandHandler;
|
||||
use Homepage\Infrastructure\Session\Middleware\SessionMiddleware;
|
||||
use Template\Handling\UserSession\Handler\Command\LoginUser\LoginUserCommandBuilder;
|
||||
use Template\Handling\UserSession\Handler\Command\LoginUser\LoginUserCommandHandler;
|
||||
use Template\Infrastructure\Session\Middleware\SessionMiddleware;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
@ -2,12 +2,12 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\Authentication\Handler;
|
||||
namespace Template\API\External\Authentication\Handler;
|
||||
|
||||
use Homepage\Handling\UserSession\Handler\Command\LogoutUser\LogoutUserCommandBuilder;
|
||||
use Homepage\Handling\UserSession\Handler\Command\LogoutUser\LogoutUserCommandHandler;
|
||||
use Homepage\Infrastructure\Response\SuccessResponse;
|
||||
use Homepage\Infrastructure\Session\Middleware\SessionMiddleware;
|
||||
use Template\Handling\UserSession\Handler\Command\LogoutUser\LogoutUserCommandBuilder;
|
||||
use Template\Handling\UserSession\Handler\Command\LogoutUser\LogoutUserCommandHandler;
|
||||
use Template\Infrastructure\Response\SuccessResponse;
|
||||
use Template\Infrastructure\Session\Middleware\SessionMiddleware;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
@ -2,15 +2,15 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\Authentication\Handler;
|
||||
namespace Template\API\External\Authentication\Handler;
|
||||
|
||||
use Homepage\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandBuilder;
|
||||
use Homepage\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandHandler;
|
||||
use Homepage\Infrastructure\Exception\Middleware\HomepageExceptionHandlerMiddleware;
|
||||
use Homepage\Infrastructure\Logging\Logger\Logger;
|
||||
use Homepage\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware;
|
||||
use Homepage\Infrastructure\Response\SuccessResponse;
|
||||
use Homepage\Infrastructure\Session\Middleware\SessionMiddleware;
|
||||
use Template\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandBuilder;
|
||||
use Template\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandHandler;
|
||||
use Template\Infrastructure\Exception\Middleware\TemplateExceptionHandlerMiddleware;
|
||||
use Template\Infrastructure\Logging\Logger\Logger;
|
||||
use Template\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware;
|
||||
use Template\Infrastructure\Response\SuccessResponse;
|
||||
use Template\Infrastructure\Session\Middleware\SessionMiddleware;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Homepage\API\External\Health\Handler\HealthHandler;
|
||||
use Template\API\External\Health\Handler\HealthHandler;
|
||||
|
||||
return [
|
||||
[
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Homepage\API\External\Health\Handler\HealthHandler;
|
||||
use Template\API\External\Health\Handler\HealthHandler;
|
||||
use Reinfi\DependencyInjection\Factory\AutoWiringFactory;
|
||||
|
||||
return [
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\Health;
|
||||
namespace Template\API\External\Health;
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\Health\Handler;
|
||||
namespace Template\API\External\Health\Handler;
|
||||
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
51
src/ApiDomain/External/Product/config/routes.php
vendored
51
src/ApiDomain/External/Product/config/routes.php
vendored
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Homepage\API\External\Product\Handler\CreateProductHandler;
|
||||
use Homepage\API\External\Product\Handler\DeleteProductHandler;
|
||||
use Homepage\API\External\Product\Handler\ProductListHandler;
|
||||
use Homepage\API\External\Product\Handler\UpdateProductHandler;
|
||||
use Homepage\Infrastructure\Rbac\Middleware\EnsureAuthorizationMiddleware;
|
||||
use Homepage\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
|
||||
|
||||
return [
|
||||
[
|
||||
'name' => 'product.product-list',
|
||||
'path' => '/api/product/product-list',
|
||||
'allowed_methods' => ['GET'],
|
||||
'middleware' => [
|
||||
LoggedInUserMiddleware::class,
|
||||
EnsureAuthorizationMiddleware::class,
|
||||
ProductListHandler::class
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'product.create-product',
|
||||
'path' => '/api/product/create-product',
|
||||
'allowed_methods' => ['POST'],
|
||||
'middleware' => [
|
||||
LoggedInUserMiddleware::class,
|
||||
EnsureAuthorizationMiddleware::class,
|
||||
CreateProductHandler::class
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'product.delete-product',
|
||||
'path' => '/api/product/delete-product',
|
||||
'allowed_methods' => ['POST'],
|
||||
'middleware' => [
|
||||
LoggedInUserMiddleware::class,
|
||||
EnsureAuthorizationMiddleware::class,
|
||||
DeleteProductHandler::class
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'product.update-product',
|
||||
'path' => '/api/product/update-product',
|
||||
'allowed_methods' => ['POST'],
|
||||
'middleware' => [
|
||||
LoggedInUserMiddleware::class,
|
||||
EnsureAuthorizationMiddleware::class,
|
||||
UpdateProductHandler::class
|
||||
],
|
||||
],
|
||||
];
|
||||
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Homepage\API\External\Product\Formatter\ProductFormatter;
|
||||
use Homepage\API\External\Product\Formatter\ProductListFormatter;
|
||||
use Homepage\API\External\Product\Handler\CreateProductHandler;
|
||||
use Homepage\API\External\Product\Handler\DeleteProductHandler;
|
||||
use Homepage\API\External\Product\Handler\ProductListHandler;
|
||||
use Homepage\API\External\Product\Handler\UpdateProductHandler;
|
||||
use Reinfi\DependencyInjection\Factory\AutoWiringFactory;
|
||||
|
||||
return [
|
||||
'factories' => [
|
||||
// Formatter
|
||||
ProductFormatter::class => AutoWiringFactory::class,
|
||||
ProductListFormatter::class => AutoWiringFactory::class,
|
||||
|
||||
// Handler
|
||||
ProductListHandler::class => AutoWiringFactory::class,
|
||||
CreateProductHandler::class => AutoWiringFactory::class,
|
||||
DeleteProductHandler::class => AutoWiringFactory::class,
|
||||
UpdateProductHandler::class => AutoWiringFactory::class,
|
||||
],
|
||||
]
|
||||
|
||||
?>
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\Product;
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'dependencies' => require __DIR__ . '/./../config/service_manager.php',
|
||||
'routes' => require __DIR__ . '/./../config/routes.php',
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\API\External\Product\Formatter;
|
||||
|
||||
use DateTime;
|
||||
use Homepage\Data\Business\Entity\Product;
|
||||
|
||||
class ProductFormatter {
|
||||
|
||||
public function format(Product $product): array {
|
||||
return [
|
||||
'id' => $product->getId()->toString(),
|
||||
'identifier' => $product->getIdentifier(),
|
||||
'name' => $product->getName(),
|
||||
'url' => $product->getUrl(),
|
||||
'created' => $product->getCreatedAt()->format(DateTime::ATOM),
|
||||
'updated' => $product->getUpdatedAt()->format(DateTime::ATOM)
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\API\External\Product\Formatter;
|
||||
|
||||
use Homepage\Data\Business\Entity\Product;
|
||||
|
||||
class ProductListFormatter {
|
||||
|
||||
public function __construct(
|
||||
private readonly ProductFormatter $productFormatter
|
||||
) {
|
||||
}
|
||||
|
||||
public function format(array $products): array {
|
||||
$list = [];
|
||||
|
||||
/** @var Product $product */
|
||||
foreach ($products as $product) {
|
||||
$list[] = $this->productFormatter->format(
|
||||
$product
|
||||
);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\Product\Handler;
|
||||
|
||||
use Homepage\API\External\Product\Formatter\ProductFormatter;
|
||||
use Homepage\Handling\Product\Handler\Command\CreateProduct\CreateProductCommandBuilder;
|
||||
use Homepage\Handling\Product\Handler\Command\CreateProduct\CreateProductCommandHandler;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
class CreateProductHandler implements RequestHandlerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly CreateProductCommandHandler $handler,
|
||||
private readonly CreateProductCommandBuilder $builder,
|
||||
private readonly ProductFormatter $productFormatter,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(ServerRequestInterface $request): ResponseInterface
|
||||
{
|
||||
$data = json_decode(
|
||||
$request->getBody()->getContents(),
|
||||
true
|
||||
);
|
||||
|
||||
$query = $this->builder->build(
|
||||
$data['identifier'],
|
||||
$data['name'] ?? null
|
||||
);
|
||||
$result = $this->handler->execute($query);
|
||||
|
||||
return new JsonResponse(
|
||||
$this->productFormatter->format($result)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\Product\Handler;
|
||||
|
||||
use Homepage\Handling\Product\Handler\Command\DeleteProduct\DeleteProductCommandBuilder;
|
||||
use Homepage\Handling\Product\Handler\Command\DeleteProduct\DeleteProductCommandHandler;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
class DeleteProductHandler implements RequestHandlerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly DeleteProductCommandHandler $handler,
|
||||
private readonly DeleteProductCommandBuilder $builder,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(ServerRequestInterface $request): ResponseInterface
|
||||
{
|
||||
$data = json_decode(
|
||||
$request->getBody()->getContents(),
|
||||
true
|
||||
);
|
||||
|
||||
$query = $this->builder->build(
|
||||
$data['id']
|
||||
);
|
||||
$result = $this->handler->execute($query);
|
||||
|
||||
return new JsonResponse("OK");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\Product\Handler;
|
||||
|
||||
use Homepage\API\External\Product\Formatter\ProductListFormatter;
|
||||
use Homepage\Handling\Product\Handler\Query\ProductList\ProductListQueryBuilder;
|
||||
use Homepage\Handling\Product\Handler\Query\ProductList\ProductListQueryHandler;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
class ProductListHandler implements RequestHandlerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ProductListQueryHandler $handler,
|
||||
private readonly ProductListQueryBuilder $builder,
|
||||
private readonly ProductListFormatter $productListFormatter
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(ServerRequestInterface $request): ResponseInterface
|
||||
{
|
||||
$query = $this->builder->build( '*' );
|
||||
$result = $this->handler->execute($query);
|
||||
|
||||
return new JsonResponse(
|
||||
$this->productListFormatter->format($result)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\Product\Handler;
|
||||
|
||||
use Homepage\API\External\Product\Formatter\ProductFormatter;
|
||||
use Homepage\Handling\Product\Handler\Command\UpdateProduct\UpdateProductCommandBuilder;
|
||||
use Homepage\Handling\Product\Handler\Command\UpdateProduct\UpdateProductCommandHandler;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
class UpdateProductHandler implements RequestHandlerInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly UpdateProductCommandHandler $handler,
|
||||
private readonly UpdateProductCommandBuilder $builder,
|
||||
private readonly ProductFormatter $productFormatter,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(ServerRequestInterface $request): ResponseInterface
|
||||
{
|
||||
$data = json_decode(
|
||||
$request->getBody()->getContents(),
|
||||
true
|
||||
);
|
||||
|
||||
$query = $this->builder->build(
|
||||
$data['id'],
|
||||
$data['identifier'],
|
||||
$data['name'] ?? null,
|
||||
$data['url'] ?? null
|
||||
);
|
||||
$result = $this->handler->execute($query);
|
||||
|
||||
return new JsonResponse(
|
||||
$this->productFormatter->format($result)
|
||||
);
|
||||
}
|
||||
}
|
||||
12
src/ApiDomain/External/User/config/routes.php
vendored
12
src/ApiDomain/External/User/config/routes.php
vendored
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Homepage\API\External\User\Handler\ChangePasswordHandler;
|
||||
use Homepage\API\External\User\Handler\ChangeUsernameHandler;
|
||||
use Homepage\API\External\User\Handler\CreateUserHandler;
|
||||
use Homepage\API\External\User\Handler\UserStateHandler;
|
||||
use Homepage\Infrastructure\Rbac\Middleware\EnsureAuthorizationMiddleware;
|
||||
use Homepage\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
|
||||
use Template\API\External\User\Handler\ChangePasswordHandler;
|
||||
use Template\API\External\User\Handler\ChangeUsernameHandler;
|
||||
use Template\API\External\User\Handler\CreateUserHandler;
|
||||
use Template\API\External\User\Handler\UserStateHandler;
|
||||
use Template\Infrastructure\Rbac\Middleware\EnsureAuthorizationMiddleware;
|
||||
use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
|
||||
|
||||
return [
|
||||
[
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Homepage\API\External\User\Formatter\UserFormatter;
|
||||
use Homepage\API\External\User\Handler\ChangePasswordHandler;
|
||||
use Homepage\API\External\User\Handler\ChangeUsernameHandler;
|
||||
use Homepage\API\External\User\Handler\CreateUserHandler;
|
||||
use Homepage\API\External\User\Handler\UserStateHandler;
|
||||
use Template\API\External\User\Formatter\UserFormatter;
|
||||
use Template\API\External\User\Handler\ChangePasswordHandler;
|
||||
use Template\API\External\User\Handler\ChangeUsernameHandler;
|
||||
use Template\API\External\User\Handler\CreateUserHandler;
|
||||
use Template\API\External\User\Handler\UserStateHandler;
|
||||
use Reinfi\DependencyInjection\Factory\AutoWiringFactory;
|
||||
|
||||
return [
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\User;
|
||||
namespace Template\API\External\User;
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\API\External\User\Formatter;
|
||||
namespace Template\API\External\User\Formatter;
|
||||
|
||||
use DateTime;
|
||||
use Homepage\Data\Business\Entity\User;
|
||||
use Template\Data\Business\Entity\User;
|
||||
|
||||
class UserFormatter {
|
||||
|
||||
|
||||
@ -2,13 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\User\Handler;
|
||||
namespace Template\API\External\User\Handler;
|
||||
|
||||
use Homepage\Data\Business\Entity\User;
|
||||
use Homepage\Handling\User\Handler\Command\ChangePassword\ChangePasswordCommandBuilder;
|
||||
use Homepage\Handling\User\Handler\Command\ChangePassword\ChangePasswordCommandHandler;
|
||||
use Homepage\Infrastructure\Response\SuccessResponse;
|
||||
use Homepage\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
|
||||
use Template\Data\Business\Entity\User;
|
||||
use Template\Handling\User\Handler\Command\ChangePassword\ChangePasswordCommandBuilder;
|
||||
use Template\Handling\User\Handler\Command\ChangePassword\ChangePasswordCommandHandler;
|
||||
use Template\Infrastructure\Response\SuccessResponse;
|
||||
use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
@ -2,13 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\User\Handler;
|
||||
namespace Template\API\External\User\Handler;
|
||||
|
||||
use Homepage\Data\Business\Entity\User;
|
||||
use Homepage\Handling\User\Handler\Command\ChangeUsername\ChangeUsernameCommandBuilder;
|
||||
use Homepage\Handling\User\Handler\Command\ChangeUsername\ChangeUsernameCommandHandler;
|
||||
use Homepage\Infrastructure\Response\SuccessResponse;
|
||||
use Homepage\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
|
||||
use Template\Data\Business\Entity\User;
|
||||
use Template\Handling\User\Handler\Command\ChangeUsername\ChangeUsernameCommandBuilder;
|
||||
use Template\Handling\User\Handler\Command\ChangeUsername\ChangeUsernameCommandHandler;
|
||||
use Template\Infrastructure\Response\SuccessResponse;
|
||||
use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
@ -2,11 +2,11 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\User\Handler;
|
||||
namespace Template\API\External\User\Handler;
|
||||
|
||||
use Homepage\API\External\User\Formatter\UserFormatter;
|
||||
use Homepage\Handling\User\Handler\Command\CreateUser\CreateUserCommandBuilder;
|
||||
use Homepage\Handling\User\Handler\Command\CreateUser\CreateUserCommandHandler;
|
||||
use Template\API\External\User\Formatter\UserFormatter;
|
||||
use Template\Handling\User\Handler\Command\CreateUser\CreateUserCommandBuilder;
|
||||
use Template\Handling\User\Handler\Command\CreateUser\CreateUserCommandHandler;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
@ -2,13 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\API\External\User\Handler;
|
||||
namespace Template\API\External\User\Handler;
|
||||
|
||||
use Homepage\API\External\User\Formatter\UserFormatter;
|
||||
use Homepage\Data\Business\Entity\User;
|
||||
use Homepage\Handling\User\Handler\Command\CreateUser\CreateUserCommandBuilder;
|
||||
use Homepage\Handling\User\Handler\Command\CreateUser\ChangePasswordCommandHandler;
|
||||
use Homepage\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
|
||||
use Template\API\External\User\Formatter\UserFormatter;
|
||||
use Template\Data\Business\Entity\User;
|
||||
use Template\Handling\User\Handler\Command\CreateUser\CreateUserCommandBuilder;
|
||||
use Template\Handling\User\Handler\Command\CreateUser\ChangePasswordCommandHandler;
|
||||
use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
@ -6,7 +6,7 @@ use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
|
||||
|
||||
return [
|
||||
'configuration' => [
|
||||
'orm_homepage' => [
|
||||
'orm_template' => [
|
||||
'second_level_cache' => [
|
||||
'enabled' => false,
|
||||
]
|
||||
@ -14,7 +14,7 @@ return [
|
||||
],
|
||||
|
||||
'driver' => [
|
||||
'orm_homepage_annotation_driver' => [
|
||||
'orm_template_annotation_driver' => [
|
||||
'class' => AnnotationDriver::class,
|
||||
'cache' => 'array',
|
||||
'paths' => [
|
||||
@ -22,16 +22,16 @@ return [
|
||||
],
|
||||
],
|
||||
|
||||
'orm_homepage' => [
|
||||
'orm_template' => [
|
||||
'class' => MappingDriverChain::class,
|
||||
'drivers' => [
|
||||
'Homepage\Data\Business\Entity' => 'orm_homepage_annotation_driver',
|
||||
'Template\Data\Business\Entity' => 'orm_template_annotation_driver',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'connection' => [
|
||||
'orm_homepage' => [
|
||||
'orm_template' => [
|
||||
'driverClass' => Driver::class,
|
||||
'params' => [
|
||||
'driver' => $_ENV['DB_DRIVER'],
|
||||
@ -45,10 +45,10 @@ return [
|
||||
],
|
||||
|
||||
'migrations_configuration' => [
|
||||
'orm_homepage' => [
|
||||
'directory' => 'data/migrations/homepage',
|
||||
'name' => 'Doctrine Database Migrations for Homepage',
|
||||
'namespace' => 'Homepage\Migrations\Homepage',
|
||||
'orm_template' => [
|
||||
'directory' => 'data/migrations/template',
|
||||
'name' => 'Doctrine Database Migrations for Template',
|
||||
'namespace' => 'Template\Migrations\Template',
|
||||
'table' => 'migrations',
|
||||
],
|
||||
],
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Homepage\Data\Business\Entity\User;
|
||||
use Homepage\Data\Business\Factory\HomepageEntityManagerFactory;
|
||||
use Homepage\Data\Business\Manager\HomepageEntityManager;
|
||||
use Homepage\Data\Business\Repository\UserRepository;
|
||||
use Homepage\Infrastructure\Database\AutowireRepositoryFactory;
|
||||
use Template\Data\Business\Entity\User;
|
||||
use Template\Data\Business\Factory\TemplateEntityManagerFactory;
|
||||
use Template\Data\Business\Manager\TemplateEntityManager;
|
||||
use Template\Data\Business\Repository\UserRepository;
|
||||
use Template\Infrastructure\Database\AutowireRepositoryFactory;
|
||||
use Roave\PsrContainerDoctrine\ConfigurationFactory;
|
||||
use Roave\PsrContainerDoctrine\ConnectionFactory;
|
||||
use Roave\PsrContainerDoctrine\EntityManagerFactory;
|
||||
|
||||
return [
|
||||
'factories' => [
|
||||
'doctrine.entity_manager.orm_homepage' => [EntityManagerFactory::class, 'orm_homepage'],
|
||||
'doctrine.configuration.orm_homepage' => [ConfigurationFactory::class, 'orm_homepage'],
|
||||
'doctrine.connection.orm_homepage' => [ConnectionFactory::class, 'orm_homepage'],
|
||||
HomepageEntityManager::class => HomepageEntityManagerFactory::class,
|
||||
'doctrine.entity_manager.orm_template' => [EntityManagerFactory::class, 'orm_template'],
|
||||
'doctrine.configuration.orm_template' => [ConfigurationFactory::class, 'orm_template'],
|
||||
'doctrine.connection.orm_template' => [ConnectionFactory::class, 'orm_template'],
|
||||
TemplateEntityManager::class => TemplateEntityManagerFactory::class,
|
||||
|
||||
UserRepository::class => [AutowireRepositoryFactory::class, HomepageEntityManager::class, User::class],
|
||||
UserRepository::class => [AutowireRepositoryFactory::class, TemplateEntityManager::class, User::class],
|
||||
],
|
||||
];
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Data\Business;
|
||||
namespace Template\Data\Business;
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Business\Entity;
|
||||
namespace Template\Data\Business\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Homepage\Infrastructure\UuidGenerator\UuidGenerator;
|
||||
use Template\Infrastructure\UuidGenerator\UuidGenerator;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="Homepage\Data\Business\Repository\PermissionRepository")
|
||||
* @ORM\Entity(repositoryClass="Template\Data\Business\Repository\PermissionRepository")
|
||||
* @ORM\Table(name="permission")
|
||||
*/
|
||||
class Permission {
|
||||
@ -23,7 +23,7 @@ class Permission {
|
||||
private ?UuidInterface $productId;
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="Homepage\Data\Business\Entity\Product")
|
||||
* @ORM\OneToOne(targetEntity="Template\Data\Business\Entity\Product")
|
||||
* @ORM\JoinColumn(name="product_id", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
private ?Product $product;
|
||||
@ -32,7 +32,7 @@ class Permission {
|
||||
private string $identifier;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Homepage\Data\Business\Entity\Role", inversedBy="permissions")
|
||||
* @ORM\ManyToMany(targetEntity="Template\Data\Business\Entity\Role", inversedBy="permissions")
|
||||
* @ORM\JoinTable(
|
||||
* name="role_permission",
|
||||
* joinColumns={@ORM\JoinColumn(name="permission_id", referencedColumnName="id")},
|
||||
|
||||
@ -1,99 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Business\Entity;
|
||||
|
||||
use DateTime;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Homepage\Infrastructure\UuidGenerator\UuidGenerator;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="Homepage\Data\Business\Repository\ProductRepository")
|
||||
* @ORM\Table(name="product")
|
||||
*/
|
||||
class Product {
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="uuid_binary_ordered_time")
|
||||
*/
|
||||
private UuidInterface $id;
|
||||
|
||||
/** @ORM\Column(name="identifier", type="string") */
|
||||
private string $identifier;
|
||||
|
||||
/** @ORM\Column(name="name", type="string", nullable="true") */
|
||||
private ?string $name;
|
||||
|
||||
/** @ORM\Column(name="url", type="string", nullable="true") */
|
||||
private ?string $url;
|
||||
|
||||
/** @ORM\Column(name="created_at", type="datetime") */
|
||||
private DateTime $createdAt;
|
||||
|
||||
/** @ORM\Column(name="updated_at", type="datetime") */
|
||||
private DateTime $updatedAt;
|
||||
|
||||
|
||||
public function __construct() {
|
||||
$this->id = UuidGenerator::generate();
|
||||
|
||||
$now = new DateTime();
|
||||
$this->setCreatedAt($now);
|
||||
$this->setUpdatedAt($now);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\PrePersist
|
||||
* @ORM\PreUpdate
|
||||
*/
|
||||
public function updateTimestamps(): void {
|
||||
$now = new DateTime();
|
||||
$this->setUpdatedAt($now);
|
||||
}
|
||||
|
||||
|
||||
public function getId(): UuidInterface {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getIdentifier(): string {
|
||||
return $this->identifier;
|
||||
}
|
||||
|
||||
public function setIdentifier(string $identifier): void {
|
||||
$this->identifier = $identifier;
|
||||
}
|
||||
|
||||
public function getName(): ?string {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(?string $name): void {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getUrl(): ?string {
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function setUrl(?string $url): void {
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
public function getCreatedAt(): DateTime {
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
public function setCreatedAt(DateTime $createdAt): void {
|
||||
$this->createdAt = $createdAt;
|
||||
}
|
||||
|
||||
public function getUpdatedAt(): DateTime {
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
public function setUpdatedAt(DateTime $updatedAt): void {
|
||||
$this->updatedAt = $updatedAt;
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Business\Entity;
|
||||
namespace Template\Data\Business\Entity;
|
||||
|
||||
use DateTime;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Homepage\Infrastructure\UuidGenerator\UuidGenerator;
|
||||
use Template\Infrastructure\UuidGenerator\UuidGenerator;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="Homepage\Data\Business\Repository\RegistrationRepository")
|
||||
* @ORM\Entity(repositoryClass="Template\Data\Business\Repository\RegistrationRepository")
|
||||
* @ORM\Table(name="registration")
|
||||
*/
|
||||
class Registration {
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Business\Entity;
|
||||
namespace Template\Data\Business\Entity;
|
||||
|
||||
use DateTime;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Homepage\Infrastructure\UuidGenerator\UuidGenerator;
|
||||
use Template\Infrastructure\UuidGenerator\UuidGenerator;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="Homepage\Data\Business\Repository\RoleRepository")
|
||||
* @ORM\Entity(repositoryClass="Template\Data\Business\Repository\RoleRepository")
|
||||
* @ORM\Table(name="role")
|
||||
*/
|
||||
class Role {
|
||||
@ -24,7 +24,7 @@ class Role {
|
||||
private ?UuidInterface $productId;
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="Homepage\Data\Business\Entity\Product")
|
||||
* @ORM\OneToOne(targetEntity="Template\Data\Business\Entity\Product")
|
||||
* @ORM\JoinColumn(name="product_id", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
private ?Product $product;
|
||||
@ -33,7 +33,7 @@ class Role {
|
||||
private string $identifier;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Homepage\Data\Business\Entity\Permission", mappedBy="roles")
|
||||
* @ORM\ManyToMany(targetEntity="Template\Data\Business\Entity\Permission", mappedBy="roles")
|
||||
* @ORM\JoinTable(
|
||||
* name="role_permission",
|
||||
* joinColumns={@ORM\JoinColumn(name="role_id", referencedColumnName="id")},
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Business\Entity;
|
||||
namespace Template\Data\Business\Entity;
|
||||
|
||||
use DateTime;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Homepage\Infrastructure\UuidGenerator\UuidGenerator;
|
||||
use Template\Infrastructure\UuidGenerator\UuidGenerator;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="Homepage\Data\Business\Repository\UserRepository")
|
||||
* @ORM\Entity(repositoryClass="Template\Data\Business\Repository\UserRepository")
|
||||
* @ORM\Table(name="user")
|
||||
*/
|
||||
class User {
|
||||
@ -22,7 +22,7 @@ class User {
|
||||
private UuidInterface $roleId;
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="Homepage\Data\Business\Entity\Role")
|
||||
* @ORM\OneToOne(targetEntity="Template\Data\Business\Entity\Role")
|
||||
* @ORM\JoinColumn(name="role_id", referencedColumnName="id")
|
||||
*/
|
||||
private Role $role;
|
||||
@ -36,7 +36,7 @@ class User {
|
||||
/** @ORM\Column(name="password", type="string") */
|
||||
private string $password;
|
||||
|
||||
/** @ORM\OneToOne(targetEntity="Homepage\Data\Business\Entity\UserSession", mappedBy="user") */
|
||||
/** @ORM\OneToOne(targetEntity="Template\Data\Business\Entity\UserSession", mappedBy="user") */
|
||||
private ?UserSession $session;
|
||||
|
||||
/** @ORM\Column(name="last_login_at", type="datetime", nullable=true) */
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Business\Entity;
|
||||
namespace Template\Data\Business\Entity;
|
||||
|
||||
use DateTime;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Homepage\Infrastructure\UuidGenerator\UuidGenerator;
|
||||
use Template\Infrastructure\UuidGenerator\UuidGenerator;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="Homepage\Data\Business\Repository\UserSessionRepository")
|
||||
* @ORM\Entity(repositoryClass="Template\Data\Business\Repository\UserSessionRepository")
|
||||
* @ORM\Table(name="user_session")
|
||||
*/
|
||||
class UserSession {
|
||||
@ -22,7 +22,7 @@ class UserSession {
|
||||
private ?UuidInterface $userId;
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="Homepage\Data\Business\Entity\User", mappedBy="session")
|
||||
* @ORM\OneToOne(targetEntity="Template\Data\Business\Entity\User", mappedBy="session")
|
||||
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
private ?User $user;
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Data\Business\Factory;
|
||||
|
||||
use Homepage\Data\Business\Manager\HomepageEntityManager;
|
||||
use Laminas\ServiceManager\Factory\FactoryInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
class HomepageEntityManagerFactory implements FactoryInterface
|
||||
{
|
||||
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): HomepageEntityManager
|
||||
{
|
||||
return new HomepageEntityManager(
|
||||
$container->get('doctrine.entity_manager.orm_homepage')
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Template\Data\Business\Factory;
|
||||
|
||||
use Template\Data\Business\Manager\TemplateEntityManager;
|
||||
use Laminas\ServiceManager\Factory\FactoryInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
class TemplateEntityManagerFactory implements FactoryInterface
|
||||
{
|
||||
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): TemplateEntityManager
|
||||
{
|
||||
return new TemplateEntityManager(
|
||||
$container->get('doctrine.entity_manager.orm_template')
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Data\Business\Manager;
|
||||
|
||||
use Doctrine\ORM\Decorator\EntityManagerDecorator;
|
||||
|
||||
class HomepageEntityManager extends EntityManagerDecorator
|
||||
{
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Template\Data\Business\Manager;
|
||||
|
||||
use Doctrine\ORM\Decorator\EntityManagerDecorator;
|
||||
|
||||
class TemplateEntityManager extends EntityManagerDecorator
|
||||
{
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Business\Repository;
|
||||
namespace Template\Data\Business\Repository;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Business\Repository;
|
||||
namespace Template\Data\Business\Repository;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Business\Repository;
|
||||
namespace Template\Data\Business\Repository;
|
||||
|
||||
use Homepage\Data\Business\Entity\Registration;
|
||||
use Template\Data\Business\Entity\Registration;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
class RegistrationRepository extends EntityRepository {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Business\Repository;
|
||||
namespace Template\Data\Business\Repository;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Business\Repository;
|
||||
namespace Template\Data\Business\Repository;
|
||||
|
||||
use Homepage\Data\Business\Entity\User;
|
||||
use Template\Data\Business\Entity\User;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
class UserRepository extends EntityRepository {
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Business\Repository;
|
||||
namespace Template\Data\Business\Repository;
|
||||
|
||||
use Homepage\Data\Business\Entity\User;
|
||||
use Template\Data\Business\Entity\User;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Homepage\Data\Business\Entity\UserSession;
|
||||
use Template\Data\Business\Entity\UserSession;
|
||||
|
||||
class UserSessionRepository extends EntityRepository {
|
||||
public function findByUser(User $user) : ?UserSession {
|
||||
|
||||
@ -25,7 +25,7 @@ return [
|
||||
'orm_log' => [
|
||||
'class' => MappingDriverChain::class,
|
||||
'drivers' => [
|
||||
'Homepage\Data\Log\Entity' => 'orm_log_annotation_driver',
|
||||
'Template\Data\Log\Entity' => 'orm_log_annotation_driver',
|
||||
],
|
||||
],
|
||||
],
|
||||
@ -48,7 +48,7 @@ return [
|
||||
'orm_log' => [
|
||||
'directory' => 'data/migrations/log',
|
||||
'name' => 'Doctrine Database Migrations for Log',
|
||||
'namespace' => 'Homepage\Migrations\Log',
|
||||
'namespace' => 'Template\Migrations\Log',
|
||||
'table' => 'migrations',
|
||||
],
|
||||
],
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Homepage\Data\Log\Factory\LogEntityManagerFactory;
|
||||
use Homepage\Data\Log\Manager\LogEntityManager;
|
||||
use Template\Data\Log\Factory\LogEntityManagerFactory;
|
||||
use Template\Data\Log\Manager\LogEntityManager;
|
||||
use Roave\PsrContainerDoctrine\ConfigurationFactory;
|
||||
use Roave\PsrContainerDoctrine\ConnectionFactory;
|
||||
use Roave\PsrContainerDoctrine\EntityManagerFactory;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Data\Log;
|
||||
namespace Template\Data\Log;
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Log\Entity;
|
||||
namespace Template\Data\Log\Entity;
|
||||
|
||||
use DateTime;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Homepage\Infrastructure\UuidGenerator\UuidGenerator;
|
||||
use Template\Infrastructure\UuidGenerator\UuidGenerator;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
/**
|
||||
* Member
|
||||
* @ORM\Entity(repositoryClass="Homepage\Data\Log\Repository\LogRepository")
|
||||
* @ORM\Entity(repositoryClass="Template\Data\Log\Repository\LogRepository")
|
||||
* @ORM\Table(name="log")
|
||||
*/
|
||||
class Log
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Data\Log\Factory;
|
||||
namespace Template\Data\Log\Factory;
|
||||
|
||||
use Homepage\Data\Log\Manager\LogEntityManager;
|
||||
use Template\Data\Log\Manager\LogEntityManager;
|
||||
use Laminas\ServiceManager\Factory\FactoryInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Data\Log\Manager;
|
||||
namespace Template\Data\Log\Manager;
|
||||
|
||||
use Doctrine\ORM\Decorator\EntityManagerDecorator;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Data\Log\Repository;
|
||||
namespace Template\Data\Log\Repository;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Homepage\Handling\Product\Builder\ProductBuilder;
|
||||
use Homepage\Handling\Product\Handler\Command\CreateProduct\CreateProductCommandBuilder;
|
||||
use Homepage\Handling\Product\Handler\Command\CreateProduct\CreateProductCommandHandler;
|
||||
use Homepage\Handling\Product\Handler\Command\DeleteProduct\DeleteProductCommandBuilder;
|
||||
use Homepage\Handling\Product\Handler\Command\DeleteProduct\DeleteProductCommandHandler;
|
||||
use Homepage\Handling\Product\Handler\Command\UpdateProduct\UpdateProductCommandBuilder;
|
||||
use Homepage\Handling\Product\Handler\Command\UpdateProduct\UpdateProductCommandHandler;
|
||||
use Homepage\Handling\Product\Handler\Query\ProductList\ProductListQueryBuilder;
|
||||
use Homepage\Handling\Product\Handler\Query\ProductList\ProductListQueryHandler;
|
||||
use Homepage\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule;
|
||||
use Template\Handling\Product\Builder\ProductBuilder;
|
||||
use Template\Handling\Product\Handler\Command\CreateProduct\CreateProductCommandBuilder;
|
||||
use Template\Handling\Product\Handler\Command\CreateProduct\CreateProductCommandHandler;
|
||||
use Template\Handling\Product\Handler\Command\DeleteProduct\DeleteProductCommandBuilder;
|
||||
use Template\Handling\Product\Handler\Command\DeleteProduct\DeleteProductCommandHandler;
|
||||
use Template\Handling\Product\Handler\Command\UpdateProduct\UpdateProductCommandBuilder;
|
||||
use Template\Handling\Product\Handler\Command\UpdateProduct\UpdateProductCommandHandler;
|
||||
use Template\Handling\Product\Handler\Query\ProductList\ProductListQueryBuilder;
|
||||
use Template\Handling\Product\Handler\Query\ProductList\ProductListQueryHandler;
|
||||
use Template\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule;
|
||||
use Reinfi\DependencyInjection\Factory\AutoWiringFactory;
|
||||
use Reinfi\DependencyInjection\Factory\InjectionFactory;
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Handling\Product\Builder;
|
||||
namespace Template\Handling\Product\Builder;
|
||||
|
||||
use Homepage\Data\Business\Entity\Product;
|
||||
use Template\Data\Business\Entity\Product;
|
||||
|
||||
class ProductBuilder
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Homepage\Handling\Product;
|
||||
namespace Template\Handling\Product;
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Handling\Product\Exception;
|
||||
namespace Template\Handling\Product\Exception;
|
||||
|
||||
use Homepage\Infrastructure\Exception\ErrorCode;
|
||||
use Homepage\Infrastructure\Exception\ErrorDomain;
|
||||
use Homepage\Infrastructure\Exception\Exception\HomepageException;
|
||||
use Template\Infrastructure\Exception\ErrorCode;
|
||||
use Template\Infrastructure\Exception\ErrorDomain;
|
||||
use Template\Infrastructure\Exception\Exception\TemplateException;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
class ProductNotFoundByIdException extends HomepageException {
|
||||
class ProductNotFoundByIdException extends TemplateException {
|
||||
|
||||
private const MESSAGE = 'The product with the Id %s was not found!';
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Handling\Product\Exception;
|
||||
namespace Template\Handling\Product\Exception;
|
||||
|
||||
use Homepage\Infrastructure\Exception\ErrorCode;
|
||||
use Homepage\Infrastructure\Exception\ErrorDomain;
|
||||
use Homepage\Infrastructure\Exception\Exception\HomepageException;
|
||||
use Template\Infrastructure\Exception\ErrorCode;
|
||||
use Template\Infrastructure\Exception\ErrorDomain;
|
||||
use Template\Infrastructure\Exception\Exception\TemplateException;
|
||||
|
||||
class ProductWithIdentifierAlreadyExists extends HomepageException {
|
||||
class ProductWithIdentifierAlreadyExists extends TemplateException {
|
||||
|
||||
private const MESSAGE = 'A product with the identifier %s does already exist!';
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Handling\Product\Handler\Command\CreateProduct;
|
||||
namespace Template\Handling\Product\Handler\Command\CreateProduct;
|
||||
|
||||
class CreateProductCommand
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Handling\Product\Handler\Command\CreateProduct;
|
||||
namespace Template\Handling\Product\Handler\Command\CreateProduct;
|
||||
|
||||
class CreateProductCommandBuilder
|
||||
{
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Handling\Product\Handler\Command\CreateProduct;
|
||||
namespace Template\Handling\Product\Handler\Command\CreateProduct;
|
||||
|
||||
use Homepage\Data\Business\Entity\Product;
|
||||
use Homepage\Handling\Product\Builder\ProductBuilder;
|
||||
use Homepage\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule;
|
||||
use Homepage\Data\Business\Manager\HomepageEntityManager;
|
||||
use Template\Data\Business\Entity\Product;
|
||||
use Template\Handling\Product\Builder\ProductBuilder;
|
||||
use Template\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule;
|
||||
use Template\Data\Business\Manager\TemplateEntityManager;
|
||||
|
||||
class CreateProductCommandHandler
|
||||
{
|
||||
public function __construct(
|
||||
private readonly HomepageEntityManager $entityManager,
|
||||
private readonly TemplateEntityManager $entityManager,
|
||||
private readonly ProductIdentifierAlreadyExistsRule $productIdentifierAlreadyExistsRule,
|
||||
private readonly ProductBuilder $builder,
|
||||
) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Handling\Product\Handler\Command\DeleteProduct;
|
||||
namespace Template\Handling\Product\Handler\Command\DeleteProduct;
|
||||
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Handling\Product\Handler\Command\DeleteProduct;
|
||||
namespace Template\Handling\Product\Handler\Command\DeleteProduct;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
|
||||
|
||||
@ -1,24 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Handling\Product\Handler\Command\DeleteProduct;
|
||||
namespace Template\Handling\Product\Handler\Command\DeleteProduct;
|
||||
|
||||
use Homepage\Data\Business\Manager\HomepageEntityManager;
|
||||
use Homepage\Data\Business\Repository\ProductRepository;
|
||||
use Homepage\Handling\Product\Exception\ProductNotFoundByIdException;
|
||||
use Template\Data\Business\Manager\TemplateEntityManager;
|
||||
use Template\Data\Business\Repository\ProductRepository;
|
||||
use Template\Handling\Product\Exception\ProductNotFoundByIdException;
|
||||
use Reinfi\DependencyInjection\Annotation\Inject;
|
||||
use Reinfi\DependencyInjection\Annotation\InjectDoctrineRepository;
|
||||
|
||||
class DeleteProductCommandHandler
|
||||
{
|
||||
/**
|
||||
* @Inject("Homepage\Data\Business\Manager\HomepageEntityManager")
|
||||
* @Inject("Template\Data\Business\Manager\TemplateEntityManager")
|
||||
* @InjectDoctrineRepository(
|
||||
* entityManager="Homepage\Data\Business\Manager\HomepageEntityManager",
|
||||
* entity="Homepage\Data\Business\Entity\Product"
|
||||
* entityManager="Template\Data\Business\Manager\TemplateEntityManager",
|
||||
* entity="Template\Data\Business\Entity\Product"
|
||||
* )
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly HomepageEntityManager $entityManager,
|
||||
private readonly TemplateEntityManager $entityManager,
|
||||
private readonly ProductRepository $repository,
|
||||
) {
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Handling\Product\Handler\Command\UpdateProduct;
|
||||
namespace Template\Handling\Product\Handler\Command\UpdateProduct;
|
||||
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Handling\Product\Handler\Command\UpdateProduct;
|
||||
namespace Template\Handling\Product\Handler\Command\UpdateProduct;
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
|
||||
@ -1,28 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Homepage\Handling\Product\Handler\Command\UpdateProduct;
|
||||
namespace Template\Handling\Product\Handler\Command\UpdateProduct;
|
||||
|
||||
use DateTime;
|
||||
use Homepage\Data\Business\Entity\Product;
|
||||
use Homepage\Data\Business\Repository\ProductRepository;
|
||||
use Homepage\Handling\Product\Exception\ProductNotFoundByIdException;
|
||||
use Homepage\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule;
|
||||
use Homepage\Data\Business\Manager\HomepageEntityManager;
|
||||
use Template\Data\Business\Entity\Product;
|
||||
use Template\Data\Business\Repository\ProductRepository;
|
||||
use Template\Handling\Product\Exception\ProductNotFoundByIdException;
|
||||
use Template\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule;
|
||||
use Template\Data\Business\Manager\TemplateEntityManager;
|
||||
use Reinfi\DependencyInjection\Annotation\Inject;
|
||||
use Reinfi\DependencyInjection\Annotation\InjectDoctrineRepository;
|
||||
|
||||
class UpdateProductCommandHandler
|
||||
{
|
||||
/**
|
||||
* @Inject("Homepage\Data\Business\Manager\HomepageEntityManager")
|
||||
* @Inject("Template\Data\Business\Manager\TemplateEntityManager")
|
||||
* @InjectDoctrineRepository(
|
||||
* entityManager="Homepage\Data\Business\Manager\HomepageEntityManager",
|
||||
* entity="Homepage\Data\Business\Entity\Product"
|
||||
* entityManager="Template\Data\Business\Manager\TemplateEntityManager",
|
||||
* entity="Template\Data\Business\Entity\Product"
|
||||
* )
|
||||
* @Inject("Homepage\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule")
|
||||
* @Inject("Template\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule")
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly HomepageEntityManager $entityManager,
|
||||
private readonly TemplateEntityManager $entityManager,
|
||||
private readonly ProductRepository $repository,
|
||||
private readonly ProductIdentifierAlreadyExistsRule $productIdentifierAlreadyExistsRule,
|
||||
) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user