first version

This commit is contained in:
Flo 2024-02-14 20:12:27 +01:00
parent c0c461a844
commit 6e01f77488
202 changed files with 728 additions and 1124 deletions

View File

@ -1,10 +1,10 @@
# DB Configuration # DB Configuration
DB_DRIVER=pdo_mysql DB_DRIVER=pdo_mysql
DB_HOST=homepage-backend-mysql DB_HOST=template-backend-mysql
DB_PORT=3306 DB_PORT=3306
DB_USER=homepage DB_USER=template
DB_PASSWORD=pass DB_PASSWORD=pass
DB_NAME=homepage DB_NAME=template
DB_NAME_LOG=log DB_NAME_LOG=log
# API Keys # API Keys
@ -14,7 +14,7 @@ FILE_API_KEY=
HOMEPAGE_API_KEY= HOMEPAGE_API_KEY=
BEE_API_KEY= BEE_API_KEY=
# Homepage Setup # Template Setup
INIT_USER_NAME=admin INIT_USER_NAME=admin
INIT_USER_PASSWORD=password INIT_USER_PASSWORD=password
INIT_USER_MAIL=admin@test.com INIT_USER_MAIL=admin@test.com

View File

@ -1,6 +1,6 @@
<?php <?php
use Homepage\Infrastructure\Logging\Logger\Logger; use Template\Infrastructure\Logging\Logger\Logger;
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;
require_once __DIR__ . '/../config/autoload/defines.php'; require_once __DIR__ . '/../config/autoload/defines.php';

View File

@ -3,7 +3,7 @@
require_once __DIR__ . '/../config/autoload/defines.php'; require_once __DIR__ . '/../config/autoload/defines.php';
require APP_ROOT . '/vendor/autoload.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\Common\Annotations\AnnotationReader;
use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\DriverManager;
use Doctrine\Migrations\Configuration\Configuration; use Doctrine\Migrations\Configuration\Configuration;
@ -40,7 +40,7 @@ $driver = new AnnotationDriver($reader, $paths);
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode); $config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$config->setMetadataDriverImpl($driver); $config->setMetadataDriverImpl($driver);
$entityManager = $container->get(HomepageEntityManager::class); $entityManager = $container->get(TemplateEntityManager::class);
try { try {
$connection = DriverManager::getConnection($dbParams); $connection = DriverManager::getConnection($dbParams);

View File

@ -3,7 +3,7 @@
require_once __DIR__ . '/../config/autoload/defines.php'; require_once __DIR__ . '/../config/autoload/defines.php';
require APP_ROOT . '/vendor/autoload.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\Common\Annotations\AnnotationReader;
use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\DriverManager;
use Doctrine\Migrations\Configuration\Configuration; use Doctrine\Migrations\Configuration\Configuration;
@ -30,17 +30,17 @@ $isDevMode = true;
$container = require APP_ROOT . '/config/container.php'; $container = require APP_ROOT . '/config/container.php';
$config = $container->get('config'); $config = $container->get('config');
$doctrineConfig = $config['doctrine']; $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']; $dbParams = $doctrineConfig['connection']['orm_template']['params'];
$migrationsConf = $doctrineConfig['migrations_configuration']['orm_homepage']; $migrationsConf = $doctrineConfig['migrations_configuration']['orm_template'];
$reader = new AnnotationReader(); $reader = new AnnotationReader();
$driver = new AnnotationDriver($reader, $paths); $driver = new AnnotationDriver($reader, $paths);
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode); $config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$config->setMetadataDriverImpl($driver); $config->setMetadataDriverImpl($driver);
$entityManager = $container->get(HomepageEntityManager::class); $entityManager = $container->get(TemplateEntityManager::class);
try { try {
$connection = DriverManager::getConnection($dbParams); $connection = DriverManager::getConnection($dbParams);

View File

@ -21,12 +21,12 @@ $SCRIPT_DIR/exec up -d
source $ENV_DIR/bin/script/drun source $ENV_DIR/bin/script/drun
# Install PHP packages # Install PHP packages
drun homepage-backend composer install drun template-backend composer install
# Migrate databases to current version # Migrate databases to current version
drun homepage-backend composer dmm drun template-backend composer dmm
drun homepage-backend composer dmlm drun template-backend composer dmlm
# Insert setup for project after this line # Insert setup for project after this line
drun homepage-backend composer console rbac:update drun template-backend composer console rbac:update
drun homepage-backend composer console init:data drun template-backend composer console init:data

View File

@ -23,46 +23,46 @@
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Homepage\\API\\Console\\": "src\/ApiDomain\/Console\/src", "Template\\API\\Console\\": "src\/ApiDomain\/Console\/src",
"Homepage\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src", "Template\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src",
"Homepage\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src", "Template\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src",
"Homepage\\API\\External\\Product\\": "src\/ApiDomain\/External\/Product\/src", "Template\\API\\External\\Product\\": "src\/ApiDomain\/External\/Product\/src",
"Homepage\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src", "Template\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src",
"Homepage\\Data\\Business\\": "src\/DataDomain\/Business\/src", "Template\\Data\\Business\\": "src\/DataDomain\/Business\/src",
"Homepage\\Data\\Log\\": "src\/DataDomain\/Log\/src", "Template\\Data\\Log\\": "src\/DataDomain\/Log\/src",
"Homepage\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src", "Template\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src",
"Homepage\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src", "Template\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src",
"Homepage\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src", "Template\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src",
"Homepage\\Handling\\User\\": "src\/HandlingDomain\/User\/src", "Template\\Handling\\User\\": "src\/HandlingDomain\/User\/src",
"Homepage\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src", "Template\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src",
"Homepage\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src", "Template\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src",
"Homepage\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src", "Template\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src",
"Homepage\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src", "Template\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src",
"Homepage\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src", "Template\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src",
"Homepage\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src", "Template\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src",
"Homepage\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src", "Template\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src",
"Homepage\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src", "Template\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src",
"Homepage\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src", "Template\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src",
"Homepage\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src", "Template\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src",
"Homepage\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src" "Template\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src"
} }
}, },
"extra": { "extra": {
"teewurst\/psr4-advanced-wildcard-composer-plugin": { "teewurst\/psr4-advanced-wildcard-composer-plugin": {
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Homepage\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/", "Template\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/",
"Homepage\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/", "Template\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/",
"Homepage\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/", "Template\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/",
"Homepage\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/" "Template\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/"
} }
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Homepage\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/", "Template\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/",
"Homepage\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/", "Template\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/",
"Homepage\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/", "Template\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/",
"Homepage\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/" "Template\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/"
} }
} }
} }
@ -96,27 +96,27 @@
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Homepage\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src", "Template\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src",
"Homepage\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src", "Template\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src",
"Homepage\\API\\External\\Product\\": "src\/ApiDomain\/External\/Product\/src", "Template\\API\\External\\Product\\": "src\/ApiDomain\/External\/Product\/src",
"Homepage\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src", "Template\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src",
"Homepage\\Data\\Business\\": "src\/DataDomain\/Business\/src", "Template\\Data\\Business\\": "src\/DataDomain\/Business\/src",
"Homepage\\Data\\Log\\": "src\/DataDomain\/Log\/src", "Template\\Data\\Log\\": "src\/DataDomain\/Log\/src",
"Homepage\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src", "Template\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src",
"Homepage\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src", "Template\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src",
"Homepage\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src", "Template\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src",
"Homepage\\Handling\\User\\": "src\/HandlingDomain\/User\/src", "Template\\Handling\\User\\": "src\/HandlingDomain\/User\/src",
"Homepage\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src", "Template\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src",
"Homepage\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src", "Template\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src",
"Homepage\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src", "Template\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src",
"Homepage\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src", "Template\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src",
"Homepage\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src", "Template\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src",
"Homepage\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src", "Template\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src",
"Homepage\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src", "Template\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src",
"Homepage\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src", "Template\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src",
"Homepage\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src", "Template\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src",
"Homepage\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src", "Template\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src",
"Homepage\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src" "Template\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src"
} }
} }
} }

View File

@ -23,25 +23,25 @@
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Homepage\\API\\Console\\": "src/ApiDomain/Console/src/" "Template\\API\\Console\\": "src/ApiDomain/Console/src/"
} }
}, },
"extra": { "extra": {
"teewurst/psr4-advanced-wildcard-composer-plugin": { "teewurst/psr4-advanced-wildcard-composer-plugin": {
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Homepage\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/", "Template\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/",
"Homepage\\Data\\%s\\": "src/DataDomain/{*}/src/", "Template\\Data\\%s\\": "src/DataDomain/{*}/src/",
"Homepage\\Handling\\%s\\": "src/HandlingDomain/{*}/src/", "Template\\Handling\\%s\\": "src/HandlingDomain/{*}/src/",
"Homepage\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/" "Template\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/"
} }
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Homepage\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/", "Template\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/",
"Homepage\\Data\\%s\\": "src/DataDomain/{*}/src/", "Template\\Data\\%s\\": "src/DataDomain/{*}/src/",
"Homepage\\Handling\\%s\\": "src/HandlingDomain/{*}/src/", "Template\\Handling\\%s\\": "src/HandlingDomain/{*}/src/",
"Homepage\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/" "Template\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/"
} }
} }
} }

View File

@ -3,13 +3,13 @@
return [ return [
'api' => [ 'api' => [
'keys' => [ 'keys' => [
'homepage' => $_ENV['HOMEPAGE_API_KEY'], 'template' => $_ENV['HOMEPAGE_API_KEY'],
'notification' => $_ENV['NOTIFICATION_API_KEY'], 'notification' => $_ENV['NOTIFICATION_API_KEY'],
], ],
'services' => [ 'services' => [
'homepage' => [ 'template' => [
'host' => 'homepage-backend-nginx', 'host' => 'template-backend-nginx',
'apis' => [ 'apis' => [
] ]

View File

@ -1,7 +1,7 @@
<?php <?php
return [ return [
'homepage-rbac' => [ 'template-rbac' => [
'roles' => [ 'roles' => [
'admin', 'admin',
'user', 'user',

View File

@ -6,8 +6,8 @@ use Monolog\Level;
return [ return [
'logger' => [ 'logger' => [
'name' => 'homepage.backend', 'name' => 'template.backend',
'path' => APP_ROOT . '/var/log/homepage.backend.log', 'path' => APP_ROOT . '/var/log/template.backend.log',
'level' => Level::Debug, 'level' => Level::Debug,
'pretty' => true, 'pretty' => true,
] ]

View File

@ -40,34 +40,34 @@ $aggregator = new ConfigAggregator([
// Data // Data
\Homepage\Data\Business\ConfigProvider::class, \Template\Data\Business\ConfigProvider::class,
\Homepage\Data\Log\ConfigProvider::class, \Template\Data\Log\ConfigProvider::class,
// Infrastructure // Infrastructure
\Homepage\Infrastructure\Database\ConfigProvider::class, \Template\Infrastructure\Database\ConfigProvider::class,
\Homepage\Infrastructure\DependencyInjection\ConfigProvider::class, \Template\Infrastructure\DependencyInjection\ConfigProvider::class,
\Homepage\Infrastructure\Encryption\ConfigProvider::class, \Template\Infrastructure\Encryption\ConfigProvider::class,
\Homepage\Infrastructure\Exception\ConfigProvider::class, \Template\Infrastructure\Exception\ConfigProvider::class,
\Homepage\Infrastructure\Logging\ConfigProvider::class, \Template\Infrastructure\Logging\ConfigProvider::class,
\Homepage\Infrastructure\Rbac\ConfigProvider::class, \Template\Infrastructure\Rbac\ConfigProvider::class,
\Homepage\Infrastructure\Request\ConfigProvider::class, \Template\Infrastructure\Request\ConfigProvider::class,
\Homepage\Infrastructure\Session\ConfigProvider::class, \Template\Infrastructure\Session\ConfigProvider::class,
// HandlingDomain // HandlingDomain
\Homepage\Handling\Product\ConfigProvider::class, \Template\Handling\Product\ConfigProvider::class,
\Homepage\Handling\User\ConfigProvider::class, \Template\Handling\User\ConfigProvider::class,
\Homepage\Handling\UserSession\ConfigProvider::class, \Template\Handling\UserSession\ConfigProvider::class,
\Homepage\Handling\Registration\ConfigProvider::class, \Template\Handling\Registration\ConfigProvider::class,
// API // API
/// Command /// Command
\Homepage\API\Console\ConfigProvider::class, \Template\API\Console\ConfigProvider::class,
/// External /// External
\Homepage\API\External\Health\ConfigProvider::class, \Template\API\External\Health\ConfigProvider::class,
\Homepage\API\External\Product\ConfigProvider::class, \Template\API\External\Product\ConfigProvider::class,
\Homepage\API\External\User\ConfigProvider::class, \Template\API\External\User\ConfigProvider::class,
\Homepage\API\External\Authentication\ConfigProvider::class, \Template\API\External\Authentication\ConfigProvider::class,
/// Internal /// Internal

View File

@ -2,9 +2,9 @@
declare(strict_types=1); declare(strict_types=1);
use Homepage\Infrastructure\Exception\Middleware\HomepageExceptionHandlerMiddleware; use Template\Infrastructure\Exception\Middleware\TemplateExceptionHandlerMiddleware;
use Homepage\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware; use Template\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware;
use Homepage\Infrastructure\Session\Middleware\SessionMiddleware; use Template\Infrastructure\Session\Middleware\SessionMiddleware;
use Laminas\Stratigility\Middleware\ErrorHandler; use Laminas\Stratigility\Middleware\ErrorHandler;
use Mezzio\Application; use Mezzio\Application;
use Mezzio\Handler\NotFoundHandler; use Mezzio\Handler\NotFoundHandler;
@ -66,11 +66,11 @@ return function (Application $app, MiddlewareFactory $factory, ContainerInterfac
//// Pre Homepage Space //// Pre Template Space
$app->pipe(HomepageExceptionHandlerMiddleware::class); $app->pipe(TemplateExceptionHandlerMiddleware::class);
$app->pipe(AnalyzeHeaderMiddleware::class); $app->pipe(AnalyzeHeaderMiddleware::class);
//// Homepage Space //// Template Space
$app->pipe(SessionMiddleware::class); $app->pipe(SessionMiddleware::class);

View File

@ -5,7 +5,7 @@ declare(strict_types=1);
use Mezzio\Application; use Mezzio\Application;
use Mezzio\MiddlewareFactory; use Mezzio\MiddlewareFactory;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use Homepage\Infrastructure\Session\Middleware\LoggedInUserMiddleware; use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
/** /**
* laminas-router route configuration * laminas-router route configuration

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Migrations\Homepage; namespace Template\Migrations\Template;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Migrations\Homepage; namespace Template\Migrations\Template;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Migrations\Homepage; namespace Template\Migrations\Template;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Migrations\Homepage; namespace Template\Migrations\Template;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Migrations\Homepage; namespace Template\Migrations\Template;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Migrations\Homepage; namespace Template\Migrations\Template;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Migrations\Homepage; namespace Template\Migrations\Template;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Migrations\Homepage; namespace Template\Migrations\Template;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Migrations\Homepage; namespace Template\Migrations\Template;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Migrations\Log; namespace Template\Migrations\Log;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;

View File

@ -1,18 +1,18 @@
version: '3' version: '3'
networks: networks:
homepage: template:
external: true external: true
services: services:
homepage-backend-mysql: template-backend-mysql:
image: homepage-backend-mysql image: template-backend-mysql
networks: networks:
- homepage - template
build: build:
context: ./../ context: ./../
dockerfile: ./docker/mysql/dockerfile dockerfile: ./docker/mysql/dockerfile
volumes: volumes:
- /Users/flo/dev/backend/homepage/var/db:/var/lib/mysql:z - /Users/flo/dev/backend/template/var/db:/var/lib/mysql:z
environment: environment:
MYSQL_USER: ${DB_USER} MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD} MYSQL_PASSWORD: ${DB_PASSWORD}
@ -23,29 +23,29 @@ services:
timeout: 20s timeout: 20s
retries: 10 retries: 10
homepage-backend-app: template-backend-app:
image: homepage-backend-app image: template-backend-app
networks: networks:
- homepage - template
build: build:
context: ./../ context: ./../
dockerfile: ./docker/php/dockerfile dockerfile: ./docker/php/dockerfile
volumes: volumes:
- /Users/flo/dev/backend/homepage/:/var/www/html:z - /Users/flo/dev/backend/template/:/var/www/html:z
ports: ports:
- 9000:9000 - 9000:9000
depends_on: depends_on:
homepage-backend-mysql: template-backend-mysql:
condition: service_healthy condition: service_healthy
homepage-backend-nginx: template-backend-nginx:
image: homepage-backend-nginx image: template-backend-nginx
networks: networks:
- homepage - template
build: build:
context: ./../ context: ./../
dockerfile: ./docker/nginx/dockerfile dockerfile: ./docker/nginx/dockerfile
ports: ports:
- 8080:80 - 8080:80
depends_on: depends_on:
- homepage-backend-app - template-backend-app

View File

@ -1,13 +1,13 @@
version: '3' version: '3'
networks: networks:
homepage: template:
external: true external: true
services: services:
homepage-backend-mysql: template-backend-mysql:
image: homepage-backend-mysql image: template-backend-mysql
networks: networks:
- homepage - template
build: build:
context: ./../ context: ./../
dockerfile: ./docker/mysql/dockerfile dockerfile: ./docker/mysql/dockerfile
@ -23,10 +23,10 @@ services:
timeout: 20s timeout: 20s
retries: 10 retries: 10
homepage-backend-app: template-backend-app:
image: homepage-backend-app image: template-backend-app
networks: networks:
- homepage - template
build: build:
context: ./../ context: ./../
dockerfile: ./docker/php/dockerfile dockerfile: ./docker/php/dockerfile
@ -35,17 +35,17 @@ services:
ports: ports:
- 9000:9000 - 9000:9000
depends_on: depends_on:
homepage-backend-mysql: template-backend-mysql:
condition: service_healthy condition: service_healthy
homepage-backend-nginx: template-backend-nginx:
image: homepage-backend-nginx image: template-backend-nginx
networks: networks:
- homepage - template
build: build:
context: ./../ context: ./../
dockerfile: ./docker/nginx/dockerfile dockerfile: ./docker/nginx/dockerfile
ports: ports:
- 8080:80 - 8080:80
depends_on: depends_on:
- homepage-backend-app - template-backend-app

View File

@ -1,4 +1,4 @@
CREATE DATABASE IF NOT EXISTS `log`; 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'@'%';

View File

@ -1,5 +1,5 @@
upstream host-backend-app { upstream host-backend-app {
server homepage-backend-app:9000; server template-backend-app:9000;
} }
server { server {

View File

@ -1,7 +1,7 @@
<?php <?php
use Homepage\API\Console\Command\InitializeDataCommand; use Template\API\Console\Command\InitializeDataCommand;
use Homepage\API\Console\Command\RbacUpdateCommand; use Template\API\Console\Command\RbacUpdateCommand;
return [ return [
'commands' => [ 'commands' => [

View File

@ -1,7 +1,7 @@
<?php <?php
use Homepage\API\Console\Command\InitializeDataCommand; use Template\API\Console\Command\InitializeDataCommand;
use Homepage\API\Console\Command\RbacUpdateCommand; use Template\API\Console\Command\RbacUpdateCommand;
use Reinfi\DependencyInjection\Factory\AutoWiringFactory; use Reinfi\DependencyInjection\Factory\AutoWiringFactory;
return [ return [

View File

@ -1,14 +1,14 @@
<?php <?php
namespace Homepage\API\Console\Command; namespace Template\API\Console\Command;
use Homepage\Data\Business\Entity\Role; use Template\Data\Business\Entity\Role;
use Homepage\Data\Business\Entity\User; use Template\Data\Business\Entity\User;
use Homepage\Data\Business\Repository\RoleRepository; use Template\Data\Business\Repository\RoleRepository;
use Homepage\Data\Business\Repository\UserRepository; use Template\Data\Business\Repository\UserRepository;
use Homepage\Data\Business\Manager\HomepageEntityManager; use Template\Data\Business\Manager\TemplateEntityManager;
use Homepage\Infrastructure\Encryption\Client\EncryptionClient; use Template\Infrastructure\Encryption\Client\EncryptionClient;
use Homepage\Infrastructure\Logging\Logger\Logger; use Template\Infrastructure\Logging\Logger\Logger;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
@ -23,7 +23,7 @@ class InitializeDataCommand extends Command
public function __construct( public function __construct(
private readonly EncryptionClient $encryptionClient, private readonly EncryptionClient $encryptionClient,
private readonly HomepageEntityManager $entityManager, private readonly TemplateEntityManager $entityManager,
private readonly Logger $logger, private readonly Logger $logger,
) { ) {
parent::__construct($this->getName()); parent::__construct($this->getName());

View File

@ -1,13 +1,13 @@
<?php <?php
namespace Homepage\API\Console\Command; namespace Template\API\Console\Command;
use Homepage\Data\Business\Entity\Permission; use Template\Data\Business\Entity\Permission;
use Homepage\Data\Business\Entity\Role; use Template\Data\Business\Entity\Role;
use Homepage\Data\Business\Repository\PermissionRepository; use Template\Data\Business\Repository\PermissionRepository;
use Homepage\Data\Business\Repository\RoleRepository; use Template\Data\Business\Repository\RoleRepository;
use Homepage\Data\Business\Manager\HomepageEntityManager; use Template\Data\Business\Manager\TemplateEntityManager;
use Homepage\Infrastructure\Logging\Logger\Logger; use Template\Infrastructure\Logging\Logger\Logger;
use Reinfi\DependencyInjection\Service\ConfigService; use Reinfi\DependencyInjection\Service\ConfigService;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
@ -24,7 +24,7 @@ class RbacUpdateCommand extends Command
public function __construct( public function __construct(
private readonly ConfigService $configService, private readonly ConfigService $configService,
private readonly HomepageEntityManager $entityManager, private readonly TemplateEntityManager $entityManager,
private readonly Logger $logger, private readonly Logger $logger,
) { ) {
parent::__construct($this->getName()); parent::__construct($this->getName());
@ -32,7 +32,7 @@ class RbacUpdateCommand extends Command
$this->roleRepository = $this->entityManager->getRepository(Role::class); $this->roleRepository = $this->entityManager->getRepository(Role::class);
$this->permissionRepository = $this->entityManager->getRepository(Permission::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( protected function execute(

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\API\Console; namespace Template\API\Console;
class ConfigProvider class ConfigProvider
{ {

View File

@ -1,10 +1,10 @@
<?php <?php
use Homepage\API\External\Authentication\Handler\ConfirmRegistrationHandler; use Template\API\External\Authentication\Handler\ConfirmRegistrationHandler;
use Homepage\API\External\Authentication\Handler\LoginUserHandler; use Template\API\External\Authentication\Handler\LoginUserHandler;
use Homepage\API\External\Authentication\Handler\LogoutUserHandler; use Template\API\External\Authentication\Handler\LogoutUserHandler;
use Homepage\API\External\Authentication\Handler\RegisterUserHandler; use Template\API\External\Authentication\Handler\RegisterUserHandler;
use Homepage\Infrastructure\Session\Middleware\LoggedInUserMiddleware; use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
return [ return [
[ [

View File

@ -1,9 +1,9 @@
<?php <?php
use Homepage\API\External\Authentication\Handler\ConfirmRegistrationHandler; use Template\API\External\Authentication\Handler\ConfirmRegistrationHandler;
use Homepage\API\External\Authentication\Handler\LoginUserHandler; use Template\API\External\Authentication\Handler\LoginUserHandler;
use Homepage\API\External\Authentication\Handler\LogoutUserHandler; use Template\API\External\Authentication\Handler\LogoutUserHandler;
use Homepage\API\External\Authentication\Handler\RegisterUserHandler; use Template\API\External\Authentication\Handler\RegisterUserHandler;
use Reinfi\DependencyInjection\Factory\AutoWiringFactory; use Reinfi\DependencyInjection\Factory\AutoWiringFactory;
return [ return [

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\API\External\Authentication; namespace Template\API\External\Authentication;
class ConfigProvider class ConfigProvider
{ {

View File

@ -2,12 +2,12 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\API\External\Authentication\Handler; namespace Template\API\External\Authentication\Handler;
use Homepage\API\External\User\Formatter\UserFormatter; use Template\API\External\User\Formatter\UserFormatter;
use Homepage\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandBuilder; use Template\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandBuilder;
use Homepage\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandHandler; use Template\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandHandler;
use Homepage\Infrastructure\Session\Middleware\SessionMiddleware; use Template\Infrastructure\Session\Middleware\SessionMiddleware;
use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;

View File

@ -2,11 +2,11 @@
declare(strict_types=1); 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 Template\Handling\UserSession\Handler\Command\LoginUser\LoginUserCommandBuilder;
use Homepage\Handling\UserSession\Handler\Command\LoginUser\LoginUserCommandHandler; use Template\Handling\UserSession\Handler\Command\LoginUser\LoginUserCommandHandler;
use Homepage\Infrastructure\Session\Middleware\SessionMiddleware; use Template\Infrastructure\Session\Middleware\SessionMiddleware;
use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;

View File

@ -2,12 +2,12 @@
declare(strict_types=1); 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 Template\Handling\UserSession\Handler\Command\LogoutUser\LogoutUserCommandBuilder;
use Homepage\Handling\UserSession\Handler\Command\LogoutUser\LogoutUserCommandHandler; use Template\Handling\UserSession\Handler\Command\LogoutUser\LogoutUserCommandHandler;
use Homepage\Infrastructure\Response\SuccessResponse; use Template\Infrastructure\Response\SuccessResponse;
use Homepage\Infrastructure\Session\Middleware\SessionMiddleware; use Template\Infrastructure\Session\Middleware\SessionMiddleware;
use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;

View File

@ -2,15 +2,15 @@
declare(strict_types=1); 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 Template\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandBuilder;
use Homepage\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandHandler; use Template\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandHandler;
use Homepage\Infrastructure\Exception\Middleware\HomepageExceptionHandlerMiddleware; use Template\Infrastructure\Exception\Middleware\TemplateExceptionHandlerMiddleware;
use Homepage\Infrastructure\Logging\Logger\Logger; use Template\Infrastructure\Logging\Logger\Logger;
use Homepage\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware; use Template\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware;
use Homepage\Infrastructure\Response\SuccessResponse; use Template\Infrastructure\Response\SuccessResponse;
use Homepage\Infrastructure\Session\Middleware\SessionMiddleware; use Template\Infrastructure\Session\Middleware\SessionMiddleware;
use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;

View File

@ -1,6 +1,6 @@
<?php <?php
use Homepage\API\External\Health\Handler\HealthHandler; use Template\API\External\Health\Handler\HealthHandler;
return [ return [
[ [

View File

@ -1,6 +1,6 @@
<?php <?php
use Homepage\API\External\Health\Handler\HealthHandler; use Template\API\External\Health\Handler\HealthHandler;
use Reinfi\DependencyInjection\Factory\AutoWiringFactory; use Reinfi\DependencyInjection\Factory\AutoWiringFactory;
return [ return [

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\API\External\Health; namespace Template\API\External\Health;
class ConfigProvider class ConfigProvider
{ {

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\API\External\Health\Handler; namespace Template\API\External\Health\Handler;
use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;

View File

@ -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
],
],
];

View File

@ -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,
],
]
?>

View File

@ -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',
];
}
}

View File

@ -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)
];
}
}

View File

@ -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;
}
}
?>

View File

@ -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)
);
}
}

View File

@ -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");
}
}
?>

View File

@ -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)
);
}
}
?>

View File

@ -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)
);
}
}

View File

@ -1,11 +1,11 @@
<?php <?php
use Homepage\API\External\User\Handler\ChangePasswordHandler; use Template\API\External\User\Handler\ChangePasswordHandler;
use Homepage\API\External\User\Handler\ChangeUsernameHandler; use Template\API\External\User\Handler\ChangeUsernameHandler;
use Homepage\API\External\User\Handler\CreateUserHandler; use Template\API\External\User\Handler\CreateUserHandler;
use Homepage\API\External\User\Handler\UserStateHandler; use Template\API\External\User\Handler\UserStateHandler;
use Homepage\Infrastructure\Rbac\Middleware\EnsureAuthorizationMiddleware; use Template\Infrastructure\Rbac\Middleware\EnsureAuthorizationMiddleware;
use Homepage\Infrastructure\Session\Middleware\LoggedInUserMiddleware; use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
return [ return [
[ [

View File

@ -1,10 +1,10 @@
<?php <?php
use Homepage\API\External\User\Formatter\UserFormatter; use Template\API\External\User\Formatter\UserFormatter;
use Homepage\API\External\User\Handler\ChangePasswordHandler; use Template\API\External\User\Handler\ChangePasswordHandler;
use Homepage\API\External\User\Handler\ChangeUsernameHandler; use Template\API\External\User\Handler\ChangeUsernameHandler;
use Homepage\API\External\User\Handler\CreateUserHandler; use Template\API\External\User\Handler\CreateUserHandler;
use Homepage\API\External\User\Handler\UserStateHandler; use Template\API\External\User\Handler\UserStateHandler;
use Reinfi\DependencyInjection\Factory\AutoWiringFactory; use Reinfi\DependencyInjection\Factory\AutoWiringFactory;
return [ return [

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\API\External\User; namespace Template\API\External\User;
class ConfigProvider class ConfigProvider
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
namespace Homepage\API\External\User\Formatter; namespace Template\API\External\User\Formatter;
use DateTime; use DateTime;
use Homepage\Data\Business\Entity\User; use Template\Data\Business\Entity\User;
class UserFormatter { class UserFormatter {

View File

@ -2,13 +2,13 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\API\External\User\Handler; namespace Template\API\External\User\Handler;
use Homepage\Data\Business\Entity\User; use Template\Data\Business\Entity\User;
use Homepage\Handling\User\Handler\Command\ChangePassword\ChangePasswordCommandBuilder; use Template\Handling\User\Handler\Command\ChangePassword\ChangePasswordCommandBuilder;
use Homepage\Handling\User\Handler\Command\ChangePassword\ChangePasswordCommandHandler; use Template\Handling\User\Handler\Command\ChangePassword\ChangePasswordCommandHandler;
use Homepage\Infrastructure\Response\SuccessResponse; use Template\Infrastructure\Response\SuccessResponse;
use Homepage\Infrastructure\Session\Middleware\LoggedInUserMiddleware; use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;

View File

@ -2,13 +2,13 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\API\External\User\Handler; namespace Template\API\External\User\Handler;
use Homepage\Data\Business\Entity\User; use Template\Data\Business\Entity\User;
use Homepage\Handling\User\Handler\Command\ChangeUsername\ChangeUsernameCommandBuilder; use Template\Handling\User\Handler\Command\ChangeUsername\ChangeUsernameCommandBuilder;
use Homepage\Handling\User\Handler\Command\ChangeUsername\ChangeUsernameCommandHandler; use Template\Handling\User\Handler\Command\ChangeUsername\ChangeUsernameCommandHandler;
use Homepage\Infrastructure\Response\SuccessResponse; use Template\Infrastructure\Response\SuccessResponse;
use Homepage\Infrastructure\Session\Middleware\LoggedInUserMiddleware; use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;

View File

@ -2,11 +2,11 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\API\External\User\Handler; namespace Template\API\External\User\Handler;
use Homepage\API\External\User\Formatter\UserFormatter; use Template\API\External\User\Formatter\UserFormatter;
use Homepage\Handling\User\Handler\Command\CreateUser\CreateUserCommandBuilder; use Template\Handling\User\Handler\Command\CreateUser\CreateUserCommandBuilder;
use Homepage\Handling\User\Handler\Command\CreateUser\CreateUserCommandHandler; use Template\Handling\User\Handler\Command\CreateUser\CreateUserCommandHandler;
use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;

View File

@ -2,13 +2,13 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\API\External\User\Handler; namespace Template\API\External\User\Handler;
use Homepage\API\External\User\Formatter\UserFormatter; use Template\API\External\User\Formatter\UserFormatter;
use Homepage\Data\Business\Entity\User; use Template\Data\Business\Entity\User;
use Homepage\Handling\User\Handler\Command\CreateUser\CreateUserCommandBuilder; use Template\Handling\User\Handler\Command\CreateUser\CreateUserCommandBuilder;
use Homepage\Handling\User\Handler\Command\CreateUser\ChangePasswordCommandHandler; use Template\Handling\User\Handler\Command\CreateUser\ChangePasswordCommandHandler;
use Homepage\Infrastructure\Session\Middleware\LoggedInUserMiddleware; use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
use Laminas\Diactoros\Response\JsonResponse; use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;

View File

@ -6,7 +6,7 @@ use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
return [ return [
'configuration' => [ 'configuration' => [
'orm_homepage' => [ 'orm_template' => [
'second_level_cache' => [ 'second_level_cache' => [
'enabled' => false, 'enabled' => false,
] ]
@ -14,7 +14,7 @@ return [
], ],
'driver' => [ 'driver' => [
'orm_homepage_annotation_driver' => [ 'orm_template_annotation_driver' => [
'class' => AnnotationDriver::class, 'class' => AnnotationDriver::class,
'cache' => 'array', 'cache' => 'array',
'paths' => [ 'paths' => [
@ -22,16 +22,16 @@ return [
], ],
], ],
'orm_homepage' => [ 'orm_template' => [
'class' => MappingDriverChain::class, 'class' => MappingDriverChain::class,
'drivers' => [ 'drivers' => [
'Homepage\Data\Business\Entity' => 'orm_homepage_annotation_driver', 'Template\Data\Business\Entity' => 'orm_template_annotation_driver',
], ],
], ],
], ],
'connection' => [ 'connection' => [
'orm_homepage' => [ 'orm_template' => [
'driverClass' => Driver::class, 'driverClass' => Driver::class,
'params' => [ 'params' => [
'driver' => $_ENV['DB_DRIVER'], 'driver' => $_ENV['DB_DRIVER'],
@ -45,10 +45,10 @@ return [
], ],
'migrations_configuration' => [ 'migrations_configuration' => [
'orm_homepage' => [ 'orm_template' => [
'directory' => 'data/migrations/homepage', 'directory' => 'data/migrations/template',
'name' => 'Doctrine Database Migrations for Homepage', 'name' => 'Doctrine Database Migrations for Template',
'namespace' => 'Homepage\Migrations\Homepage', 'namespace' => 'Template\Migrations\Template',
'table' => 'migrations', 'table' => 'migrations',
], ],
], ],

View File

@ -1,21 +1,21 @@
<?php <?php
use Homepage\Data\Business\Entity\User; use Template\Data\Business\Entity\User;
use Homepage\Data\Business\Factory\HomepageEntityManagerFactory; use Template\Data\Business\Factory\TemplateEntityManagerFactory;
use Homepage\Data\Business\Manager\HomepageEntityManager; use Template\Data\Business\Manager\TemplateEntityManager;
use Homepage\Data\Business\Repository\UserRepository; use Template\Data\Business\Repository\UserRepository;
use Homepage\Infrastructure\Database\AutowireRepositoryFactory; use Template\Infrastructure\Database\AutowireRepositoryFactory;
use Roave\PsrContainerDoctrine\ConfigurationFactory; use Roave\PsrContainerDoctrine\ConfigurationFactory;
use Roave\PsrContainerDoctrine\ConnectionFactory; use Roave\PsrContainerDoctrine\ConnectionFactory;
use Roave\PsrContainerDoctrine\EntityManagerFactory; use Roave\PsrContainerDoctrine\EntityManagerFactory;
return [ return [
'factories' => [ 'factories' => [
'doctrine.entity_manager.orm_homepage' => [EntityManagerFactory::class, 'orm_homepage'], 'doctrine.entity_manager.orm_template' => [EntityManagerFactory::class, 'orm_template'],
'doctrine.configuration.orm_homepage' => [ConfigurationFactory::class, 'orm_homepage'], 'doctrine.configuration.orm_template' => [ConfigurationFactory::class, 'orm_template'],
'doctrine.connection.orm_homepage' => [ConnectionFactory::class, 'orm_homepage'], 'doctrine.connection.orm_template' => [ConnectionFactory::class, 'orm_template'],
HomepageEntityManager::class => HomepageEntityManagerFactory::class, TemplateEntityManager::class => TemplateEntityManagerFactory::class,
UserRepository::class => [AutowireRepositoryFactory::class, HomepageEntityManager::class, User::class], UserRepository::class => [AutowireRepositoryFactory::class, TemplateEntityManager::class, User::class],
], ],
]; ];

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Data\Business; namespace Template\Data\Business;
class ConfigProvider class ConfigProvider
{ {

View File

@ -1,15 +1,15 @@
<?php <?php
namespace Homepage\Data\Business\Entity; namespace Template\Data\Business\Entity;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Homepage\Infrastructure\UuidGenerator\UuidGenerator; use Template\Infrastructure\UuidGenerator\UuidGenerator;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
/** /**
* @ORM\Entity(repositoryClass="Homepage\Data\Business\Repository\PermissionRepository") * @ORM\Entity(repositoryClass="Template\Data\Business\Repository\PermissionRepository")
* @ORM\Table(name="permission") * @ORM\Table(name="permission")
*/ */
class Permission { class Permission {
@ -23,7 +23,7 @@ class Permission {
private ?UuidInterface $productId; 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) * @ORM\JoinColumn(name="product_id", referencedColumnName="id", nullable=true)
*/ */
private ?Product $product; private ?Product $product;
@ -32,7 +32,7 @@ class Permission {
private string $identifier; 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( * @ORM\JoinTable(
* name="role_permission", * name="role_permission",
* joinColumns={@ORM\JoinColumn(name="permission_id", referencedColumnName="id")}, * joinColumns={@ORM\JoinColumn(name="permission_id", referencedColumnName="id")},

View File

@ -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;
}
}

View File

@ -1,14 +1,14 @@
<?php <?php
namespace Homepage\Data\Business\Entity; namespace Template\Data\Business\Entity;
use DateTime; use DateTime;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Homepage\Infrastructure\UuidGenerator\UuidGenerator; use Template\Infrastructure\UuidGenerator\UuidGenerator;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
/** /**
* @ORM\Entity(repositoryClass="Homepage\Data\Business\Repository\RegistrationRepository") * @ORM\Entity(repositoryClass="Template\Data\Business\Repository\RegistrationRepository")
* @ORM\Table(name="registration") * @ORM\Table(name="registration")
*/ */
class Registration { class Registration {

View File

@ -1,16 +1,16 @@
<?php <?php
namespace Homepage\Data\Business\Entity; namespace Template\Data\Business\Entity;
use DateTime; use DateTime;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Homepage\Infrastructure\UuidGenerator\UuidGenerator; use Template\Infrastructure\UuidGenerator\UuidGenerator;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
/** /**
* @ORM\Entity(repositoryClass="Homepage\Data\Business\Repository\RoleRepository") * @ORM\Entity(repositoryClass="Template\Data\Business\Repository\RoleRepository")
* @ORM\Table(name="role") * @ORM\Table(name="role")
*/ */
class Role { class Role {
@ -24,7 +24,7 @@ class Role {
private ?UuidInterface $productId; 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) * @ORM\JoinColumn(name="product_id", referencedColumnName="id", nullable=true)
*/ */
private ?Product $product; private ?Product $product;
@ -33,7 +33,7 @@ class Role {
private string $identifier; 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( * @ORM\JoinTable(
* name="role_permission", * name="role_permission",
* joinColumns={@ORM\JoinColumn(name="role_id", referencedColumnName="id")}, * joinColumns={@ORM\JoinColumn(name="role_id", referencedColumnName="id")},

View File

@ -1,14 +1,14 @@
<?php <?php
namespace Homepage\Data\Business\Entity; namespace Template\Data\Business\Entity;
use DateTime; use DateTime;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Homepage\Infrastructure\UuidGenerator\UuidGenerator; use Template\Infrastructure\UuidGenerator\UuidGenerator;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
/** /**
* @ORM\Entity(repositoryClass="Homepage\Data\Business\Repository\UserRepository") * @ORM\Entity(repositoryClass="Template\Data\Business\Repository\UserRepository")
* @ORM\Table(name="user") * @ORM\Table(name="user")
*/ */
class User { class User {
@ -22,7 +22,7 @@ class User {
private UuidInterface $roleId; 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") * @ORM\JoinColumn(name="role_id", referencedColumnName="id")
*/ */
private Role $role; private Role $role;
@ -36,7 +36,7 @@ class User {
/** @ORM\Column(name="password", type="string") */ /** @ORM\Column(name="password", type="string") */
private string $password; 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; private ?UserSession $session;
/** @ORM\Column(name="last_login_at", type="datetime", nullable=true) */ /** @ORM\Column(name="last_login_at", type="datetime", nullable=true) */

View File

@ -1,14 +1,14 @@
<?php <?php
namespace Homepage\Data\Business\Entity; namespace Template\Data\Business\Entity;
use DateTime; use DateTime;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Homepage\Infrastructure\UuidGenerator\UuidGenerator; use Template\Infrastructure\UuidGenerator\UuidGenerator;
use Ramsey\Uuid\UuidInterface; 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") * @ORM\Table(name="user_session")
*/ */
class UserSession { class UserSession {
@ -22,7 +22,7 @@ class UserSession {
private ?UuidInterface $userId; 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) * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
*/ */
private ?User $user; private ?User $user;

View File

@ -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')
);
}
}

View File

@ -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')
);
}
}

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
namespace Homepage\Data\Business\Manager;
use Doctrine\ORM\Decorator\EntityManagerDecorator;
class HomepageEntityManager extends EntityManagerDecorator
{
}

View File

@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace Template\Data\Business\Manager;
use Doctrine\ORM\Decorator\EntityManagerDecorator;
class TemplateEntityManager extends EntityManagerDecorator
{
}

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Homepage\Data\Business\Repository; namespace Template\Data\Business\Repository;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Homepage\Data\Business\Repository; namespace Template\Data\Business\Repository;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;

View File

@ -1,8 +1,8 @@
<?php <?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; use Doctrine\ORM\EntityRepository;
class RegistrationRepository extends EntityRepository { class RegistrationRepository extends EntityRepository {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Homepage\Data\Business\Repository; namespace Template\Data\Business\Repository;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;

View File

@ -1,8 +1,8 @@
<?php <?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 Doctrine\ORM\EntityRepository;
class UserRepository extends EntityRepository { class UserRepository extends EntityRepository {

View File

@ -1,10 +1,10 @@
<?php <?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 Doctrine\ORM\EntityRepository;
use Homepage\Data\Business\Entity\UserSession; use Template\Data\Business\Entity\UserSession;
class UserSessionRepository extends EntityRepository { class UserSessionRepository extends EntityRepository {
public function findByUser(User $user) : ?UserSession { public function findByUser(User $user) : ?UserSession {

View File

@ -25,7 +25,7 @@ return [
'orm_log' => [ 'orm_log' => [
'class' => MappingDriverChain::class, 'class' => MappingDriverChain::class,
'drivers' => [ 'drivers' => [
'Homepage\Data\Log\Entity' => 'orm_log_annotation_driver', 'Template\Data\Log\Entity' => 'orm_log_annotation_driver',
], ],
], ],
], ],
@ -48,7 +48,7 @@ return [
'orm_log' => [ 'orm_log' => [
'directory' => 'data/migrations/log', 'directory' => 'data/migrations/log',
'name' => 'Doctrine Database Migrations for Log', 'name' => 'Doctrine Database Migrations for Log',
'namespace' => 'Homepage\Migrations\Log', 'namespace' => 'Template\Migrations\Log',
'table' => 'migrations', 'table' => 'migrations',
], ],
], ],

View File

@ -1,7 +1,7 @@
<?php <?php
use Homepage\Data\Log\Factory\LogEntityManagerFactory; use Template\Data\Log\Factory\LogEntityManagerFactory;
use Homepage\Data\Log\Manager\LogEntityManager; use Template\Data\Log\Manager\LogEntityManager;
use Roave\PsrContainerDoctrine\ConfigurationFactory; use Roave\PsrContainerDoctrine\ConfigurationFactory;
use Roave\PsrContainerDoctrine\ConnectionFactory; use Roave\PsrContainerDoctrine\ConnectionFactory;
use Roave\PsrContainerDoctrine\EntityManagerFactory; use Roave\PsrContainerDoctrine\EntityManagerFactory;

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Data\Log; namespace Template\Data\Log;
class ConfigProvider class ConfigProvider
{ {

View File

@ -1,15 +1,15 @@
<?php <?php
namespace Homepage\Data\Log\Entity; namespace Template\Data\Log\Entity;
use DateTime; use DateTime;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Homepage\Infrastructure\UuidGenerator\UuidGenerator; use Template\Infrastructure\UuidGenerator\UuidGenerator;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
/** /**
* Member * Member
* @ORM\Entity(repositoryClass="Homepage\Data\Log\Repository\LogRepository") * @ORM\Entity(repositoryClass="Template\Data\Log\Repository\LogRepository")
* @ORM\Table(name="log") * @ORM\Table(name="log")
*/ */
class Log class Log

View File

@ -2,9 +2,9 @@
declare(strict_types=1); 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 Laminas\ServiceManager\Factory\FactoryInterface;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Data\Log\Manager; namespace Template\Data\Log\Manager;
use Doctrine\ORM\Decorator\EntityManagerDecorator; use Doctrine\ORM\Decorator\EntityManagerDecorator;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Homepage\Data\Log\Repository; namespace Template\Data\Log\Repository;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;

View File

@ -1,15 +1,15 @@
<?php <?php
use Homepage\Handling\Product\Builder\ProductBuilder; use Template\Handling\Product\Builder\ProductBuilder;
use Homepage\Handling\Product\Handler\Command\CreateProduct\CreateProductCommandBuilder; use Template\Handling\Product\Handler\Command\CreateProduct\CreateProductCommandBuilder;
use Homepage\Handling\Product\Handler\Command\CreateProduct\CreateProductCommandHandler; use Template\Handling\Product\Handler\Command\CreateProduct\CreateProductCommandHandler;
use Homepage\Handling\Product\Handler\Command\DeleteProduct\DeleteProductCommandBuilder; use Template\Handling\Product\Handler\Command\DeleteProduct\DeleteProductCommandBuilder;
use Homepage\Handling\Product\Handler\Command\DeleteProduct\DeleteProductCommandHandler; use Template\Handling\Product\Handler\Command\DeleteProduct\DeleteProductCommandHandler;
use Homepage\Handling\Product\Handler\Command\UpdateProduct\UpdateProductCommandBuilder; use Template\Handling\Product\Handler\Command\UpdateProduct\UpdateProductCommandBuilder;
use Homepage\Handling\Product\Handler\Command\UpdateProduct\UpdateProductCommandHandler; use Template\Handling\Product\Handler\Command\UpdateProduct\UpdateProductCommandHandler;
use Homepage\Handling\Product\Handler\Query\ProductList\ProductListQueryBuilder; use Template\Handling\Product\Handler\Query\ProductList\ProductListQueryBuilder;
use Homepage\Handling\Product\Handler\Query\ProductList\ProductListQueryHandler; use Template\Handling\Product\Handler\Query\ProductList\ProductListQueryHandler;
use Homepage\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule; use Template\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule;
use Reinfi\DependencyInjection\Factory\AutoWiringFactory; use Reinfi\DependencyInjection\Factory\AutoWiringFactory;
use Reinfi\DependencyInjection\Factory\InjectionFactory; use Reinfi\DependencyInjection\Factory\InjectionFactory;

View File

@ -1,8 +1,8 @@
<?php <?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 class ProductBuilder
{ {

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Homepage\Handling\Product; namespace Template\Handling\Product;
class ConfigProvider class ConfigProvider
{ {

View File

@ -1,13 +1,13 @@
<?php <?php
namespace Homepage\Handling\Product\Exception; namespace Template\Handling\Product\Exception;
use Homepage\Infrastructure\Exception\ErrorCode; use Template\Infrastructure\Exception\ErrorCode;
use Homepage\Infrastructure\Exception\ErrorDomain; use Template\Infrastructure\Exception\ErrorDomain;
use Homepage\Infrastructure\Exception\Exception\HomepageException; use Template\Infrastructure\Exception\Exception\TemplateException;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
class ProductNotFoundByIdException extends HomepageException { class ProductNotFoundByIdException extends TemplateException {
private const MESSAGE = 'The product with the Id %s was not found!'; private const MESSAGE = 'The product with the Id %s was not found!';

View File

@ -1,12 +1,12 @@
<?php <?php
namespace Homepage\Handling\Product\Exception; namespace Template\Handling\Product\Exception;
use Homepage\Infrastructure\Exception\ErrorCode; use Template\Infrastructure\Exception\ErrorCode;
use Homepage\Infrastructure\Exception\ErrorDomain; use Template\Infrastructure\Exception\ErrorDomain;
use Homepage\Infrastructure\Exception\Exception\HomepageException; 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!'; private const MESSAGE = 'A product with the identifier %s does already exist!';

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Homepage\Handling\Product\Handler\Command\CreateProduct; namespace Template\Handling\Product\Handler\Command\CreateProduct;
class CreateProductCommand class CreateProductCommand
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Homepage\Handling\Product\Handler\Command\CreateProduct; namespace Template\Handling\Product\Handler\Command\CreateProduct;
class CreateProductCommandBuilder class CreateProductCommandBuilder
{ {

View File

@ -1,16 +1,16 @@
<?php <?php
namespace Homepage\Handling\Product\Handler\Command\CreateProduct; namespace Template\Handling\Product\Handler\Command\CreateProduct;
use Homepage\Data\Business\Entity\Product; use Template\Data\Business\Entity\Product;
use Homepage\Handling\Product\Builder\ProductBuilder; use Template\Handling\Product\Builder\ProductBuilder;
use Homepage\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule; use Template\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule;
use Homepage\Data\Business\Manager\HomepageEntityManager; use Template\Data\Business\Manager\TemplateEntityManager;
class CreateProductCommandHandler class CreateProductCommandHandler
{ {
public function __construct( public function __construct(
private readonly HomepageEntityManager $entityManager, private readonly TemplateEntityManager $entityManager,
private readonly ProductIdentifierAlreadyExistsRule $productIdentifierAlreadyExistsRule, private readonly ProductIdentifierAlreadyExistsRule $productIdentifierAlreadyExistsRule,
private readonly ProductBuilder $builder, private readonly ProductBuilder $builder,
) { ) {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Homepage\Handling\Product\Handler\Command\DeleteProduct; namespace Template\Handling\Product\Handler\Command\DeleteProduct;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Homepage\Handling\Product\Handler\Command\DeleteProduct; namespace Template\Handling\Product\Handler\Command\DeleteProduct;
use Ramsey\Uuid\Uuid; use Ramsey\Uuid\Uuid;

View File

@ -1,24 +1,24 @@
<?php <?php
namespace Homepage\Handling\Product\Handler\Command\DeleteProduct; namespace Template\Handling\Product\Handler\Command\DeleteProduct;
use Homepage\Data\Business\Manager\HomepageEntityManager; use Template\Data\Business\Manager\TemplateEntityManager;
use Homepage\Data\Business\Repository\ProductRepository; use Template\Data\Business\Repository\ProductRepository;
use Homepage\Handling\Product\Exception\ProductNotFoundByIdException; use Template\Handling\Product\Exception\ProductNotFoundByIdException;
use Reinfi\DependencyInjection\Annotation\Inject; use Reinfi\DependencyInjection\Annotation\Inject;
use Reinfi\DependencyInjection\Annotation\InjectDoctrineRepository; use Reinfi\DependencyInjection\Annotation\InjectDoctrineRepository;
class DeleteProductCommandHandler class DeleteProductCommandHandler
{ {
/** /**
* @Inject("Homepage\Data\Business\Manager\HomepageEntityManager") * @Inject("Template\Data\Business\Manager\TemplateEntityManager")
* @InjectDoctrineRepository( * @InjectDoctrineRepository(
* entityManager="Homepage\Data\Business\Manager\HomepageEntityManager", * entityManager="Template\Data\Business\Manager\TemplateEntityManager",
* entity="Homepage\Data\Business\Entity\Product" * entity="Template\Data\Business\Entity\Product"
* ) * )
*/ */
public function __construct( public function __construct(
private readonly HomepageEntityManager $entityManager, private readonly TemplateEntityManager $entityManager,
private readonly ProductRepository $repository, private readonly ProductRepository $repository,
) { ) {
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Homepage\Handling\Product\Handler\Command\UpdateProduct; namespace Template\Handling\Product\Handler\Command\UpdateProduct;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Homepage\Handling\Product\Handler\Command\UpdateProduct; namespace Template\Handling\Product\Handler\Command\UpdateProduct;
use Ramsey\Uuid\Uuid; use Ramsey\Uuid\Uuid;

View File

@ -1,28 +1,28 @@
<?php <?php
namespace Homepage\Handling\Product\Handler\Command\UpdateProduct; namespace Template\Handling\Product\Handler\Command\UpdateProduct;
use DateTime; use DateTime;
use Homepage\Data\Business\Entity\Product; use Template\Data\Business\Entity\Product;
use Homepage\Data\Business\Repository\ProductRepository; use Template\Data\Business\Repository\ProductRepository;
use Homepage\Handling\Product\Exception\ProductNotFoundByIdException; use Template\Handling\Product\Exception\ProductNotFoundByIdException;
use Homepage\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule; use Template\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule;
use Homepage\Data\Business\Manager\HomepageEntityManager; use Template\Data\Business\Manager\TemplateEntityManager;
use Reinfi\DependencyInjection\Annotation\Inject; use Reinfi\DependencyInjection\Annotation\Inject;
use Reinfi\DependencyInjection\Annotation\InjectDoctrineRepository; use Reinfi\DependencyInjection\Annotation\InjectDoctrineRepository;
class UpdateProductCommandHandler class UpdateProductCommandHandler
{ {
/** /**
* @Inject("Homepage\Data\Business\Manager\HomepageEntityManager") * @Inject("Template\Data\Business\Manager\TemplateEntityManager")
* @InjectDoctrineRepository( * @InjectDoctrineRepository(
* entityManager="Homepage\Data\Business\Manager\HomepageEntityManager", * entityManager="Template\Data\Business\Manager\TemplateEntityManager",
* entity="Homepage\Data\Business\Entity\Product" * entity="Template\Data\Business\Entity\Product"
* ) * )
* @Inject("Homepage\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule") * @Inject("Template\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule")
*/ */
public function __construct( public function __construct(
private readonly HomepageEntityManager $entityManager, private readonly TemplateEntityManager $entityManager,
private readonly ProductRepository $repository, private readonly ProductRepository $repository,
private readonly ProductIdentifierAlreadyExistsRule $productIdentifierAlreadyExistsRule, private readonly ProductIdentifierAlreadyExistsRule $productIdentifierAlreadyExistsRule,
) { ) {

Some files were not shown because too many files have changed in this diff Show More