first commit

This commit is contained in:
Flo 2024-02-14 20:38:28 +01:00
parent 721dfc58d1
commit 8d896bcd12
195 changed files with 965 additions and 1267 deletions

View File

@ -1,20 +1,13 @@
# DB Configuration # DB Configuration
DB_DRIVER=pdo_mysql DB_DRIVER=pdo_mysql
DB_HOST=template-backend-mysql DB_HOST=myTube-backend-mysql
DB_PORT=3306 DB_PORT=3306
DB_USER=template DB_USER=myTube
DB_PASSWORD=pass DB_PASSWORD=pass
DB_NAME=template DB_NAME=myTube
DB_NAME_LOG=log DB_NAME_LOG=log
# API Keys # MyTube Setup
AUTH_API_KEY=
NOTIFICATION_API_KEY=
FILE_API_KEY=
HOMEPAGE_API_KEY=
BEE_API_KEY=
# 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 Template\Infrastructure\Logging\Logger\Logger; use MyTube\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';

155
bin/createApi.php Normal file
View File

@ -0,0 +1,155 @@
<?php
if (count($argv) !== 6) {
echo 'Use of this Command:' . PHP_EOL
. 'createApi API_IsExternal API_Namespace API_Name CQRS_IsCommand CQRS_Namespace' . PHP_EOL;
die;
}
$projectSourceDirectory = 'src/';
$projectNamespace = 'MyTube';
$apiType = strtolower($argv[1]) === 'true' ? 'External' : 'Internal';
$apiNamespace = $argv[2];
$apiName = $argv[3];
$cqrsType = strtolower($argv[4]) === 'true' ? 'Command' : 'Query';
$cqrsNamespace = $argv[5];
# API Handler
$apiHandlerName = $apiName . 'Handler';
$apiHandlerNamespace = $projectNamespace . '\\API\\' . $apiType . '\\' . $apiNamespace . '\\Handler';
$apiHandlerFilePath = $projectSourceDirectory . 'ApiDomain/' . $apiType . '/' . $apiNamespace . '/src/Handler/' . $apiHandlerName . '.php';
# CQRS
$cqrsFilePath = $projectSourceDirectory . 'HandlingDomain/' . $cqrsNamespace . '/src/Handler/' . $cqrsType . '/' . $apiName . '/';
$cqrsName = $apiName . $cqrsType;
$cqrsVariableName = lcfirst($cqrsName);
$cqrsNamespace = $projectNamespace . '\\Handling\\' . $cqrsNamespace . '\\Handler\\' . $cqrsType . '\\' . $apiName;
# Command / Query
$cqrsPath = $cqrsFilePath . $cqrsName . '.php';
$cqrsUsingNamespace = $cqrsNamespace . '\\' . $cqrsName;
# Handler
$cqrsHandlerName = $cqrsName . 'Handler';
$cqrsHandlerVariableName = lcfirst($cqrsHandlerName);
$cqrsHandlerPath = $cqrsFilePath . $cqrsName . 'Handler' . '.php';
$cqrsHandlerUsingNamespace = $cqrsNamespace . '\\' . $cqrsHandlerName;
# Builder
$cqrsBuilderName = $cqrsName . 'Builder';
$cqrsBuilderVariableName = lcfirst($cqrsBuilderName);
$cqrsBuilderPath = $cqrsFilePath . $cqrsName . 'Builder' . '.php';
$cqrsBuilderUsingNamespace = $cqrsNamespace . '\\' . $cqrsBuilderName;
########## WRITE FILES ###############
function writeToFile($path, $content) {
echo 'Writing contents to file ' . $path . PHP_EOL;
$directory = pathinfo($path, PATHINFO_DIRNAME);
if (!is_dir($directory)) {
mkdir($directory, 0755, true);
}
file_put_contents($path, $content);
}
$apiHandlerFileContent = "<?php
declare(strict_types=1);
namespace {$apiHandlerNamespace};
use {$cqrsHandlerUsingNamespace};
use {$cqrsBuilderUsingNamespace};
use Psr\\Http\\Message\\ResponseInterface;
use Psr\\Http\\Message\\ServerRequestInterface;
use Psr\\Http\\Server\\RequestHandlerInterface;
use Bee\\Infrastructure\\Response\\SuccessResponse;
class {$apiHandlerName} implements RequestHandlerInterface
{
public function __construct(
private readonly {$cqrsHandlerName} \${$cqrsHandlerVariableName},
private readonly {$cqrsBuilderName} \${$cqrsBuilderVariableName},
) {
}
public function handle(ServerRequestInterface \$request): ResponseInterface
{
\$data = json_decode(
\$request->getBody()->getContents(),
true
);
\${$cqrsVariableName} = \$this->{$cqrsBuilderVariableName}->build(
\$data
);
\$result = \$this->{$cqrsHandlerVariableName}->execute(\${$cqrsVariableName});
return new SuccessResponse('OK');
}
}
";
writeToFile($apiHandlerFilePath, $apiHandlerFileContent);
$cqrsFileContent = "<?php
declare(strict_types=1);
namespace {$cqrsNamespace};
class {$cqrsName}
{
public function __construct(
#TODO
) {
}
#TODO
}
";
writeToFile($cqrsPath, $cqrsFileContent);
$cqrsHandlerFileContent = "<?php
declare(strict_types=1);
namespace {$cqrsNamespace};
class {$cqrsHandlerName}
{
public function __construct(
#TODO
) {
}
public function execute({$cqrsName} \${$cqrsVariableName}): void
{
}
}
";
writeToFile($cqrsHandlerPath, $cqrsHandlerFileContent);
$cqrsBuilderFileContent = "<?php
declare(strict_types=1);
namespace {$cqrsNamespace};
class {$cqrsBuilderName}
{
public function build(
#TODO
): {$cqrsName} {
return new {$cqrsName}(
#TODO
);
}
}
";
writeToFile($cqrsBuilderPath, $cqrsBuilderFileContent);

149
bin/createPipeline.php Normal file
View File

@ -0,0 +1,149 @@
<?php
if (count($argv) < 4) {
echo 'Use of this Command:' . PHP_EOL
. 'createPipeline Handling_Namespace Pipeline_Name Step_1_Name Step_2_Name' . PHP_EOL;
die;
}
$projectSourceDirectory = 'src/';
$projectNamespace = 'MyTube';
$pipelineNamespace = $argv[1];
$pipelineName = $argv[2];
$stepNames = array_slice($argv, 3);
# Pipeline
$pipelineClassName = $pipelineName . 'Pipeline';
$pipelineVariableName = lcfirst($pipelineClassName);
$pipelineFilePath = $projectSourceDirectory . 'HandlingDomain/' . $pipelineNamespace . '/src/Pipeline/' . $pipelineName . '/' . $pipelineClassName . '.php';
$pipelineFullNamespace = $projectNamespace . '\\Handling\\' . $pipelineNamespace . '\\Pipeline\\' . $pipelineName;
$pipelineUsingNamespace = $pipelineFullNamespace . '\\' . $pipelineClassName;
# Payload
$payloadClassName = $pipelineName . 'Payload';
$payloadVariableName = lcfirst($payloadClassName);
$payloadFilePath = $projectSourceDirectory . 'HandlingDomain/' . $pipelineNamespace . '/src/Pipeline/' . $pipelineName . '/' . $payloadClassName . '.php';
$payloadFullNamespace = $projectNamespace . '\\Handling\\' . $pipelineNamespace . '\\Pipeline\\' . $pipelineName;
$payloadUsingNamespace = $payloadFullNamespace . '\\' . $payloadClassName;
# Step
$stepsFilePath = $projectSourceDirectory . 'HandlingDomain/' . $pipelineNamespace . '/src/Pipeline/' . $pipelineName . '/Step/';
$stepsFullNamespace = $projectNamespace . '\\Handling\\' . $pipelineNamespace . '\\Pipeline\\' . $pipelineName . '\\Step';
$steps = [];
foreach ($stepNames as $stepName) {
$stepClassName = $stepName . 'Step';
$steps[] = [
'stepClassName' => $stepClassName,
'stepVariableName' => lcfirst($stepClassName),
'stepFilePath' => $stepsFilePath . $stepClassName . '.php',
'stepUsingNamespace' => 'use ' . $payloadFullNamespace . '\\Step\\' . $stepClassName,
];
}
########## WRITE FILES ###############
function writeToFile($path, $content) {
echo 'Writing contents to file ' . $path . PHP_EOL;
$directory = pathinfo($path, PATHINFO_DIRNAME);
if (!is_dir($directory)) {
mkdir($directory, 0755, true);
}
file_put_contents($path, $content);
}
$stepsUsingNamespaces = [];
$stepsDeclarations = [];
$stepsReferences = [];
foreach ($steps as $step) {
$stepClassName = $step['stepClassName'];
$stepVariableName = $step['stepVariableName'];
$stepFilePath = $step['stepFilePath'];
$stepUsingNamespace = $step['stepUsingNamespace'];
$stepsUsingNamespaces[] = $stepUsingNamespace . ';';
$stepsDeclarations[] = 'private readonly ' . $stepClassName . ' $' . $stepVariableName . ',';
$stepsReferences[] = '$this->' . $stepVariableName . ',';
$stepFileContent = "<?php
declare(strict_types=1);
namespace {$stepsFullNamespace};
use {$payloadUsingNamespace};
use teewurst\\Pipeline\\PipelineInterface;
use teewurst\\Pipeline\\TaskInterface;
class {$stepClassName} implements TaskInterface
{
public function __construct(
#TODO
) {
}
public function __invoke(
\$payload,
PipelineInterface \$pipeline
): void
{
/** @var {$payloadClassName} \${$payloadVariableName} */
\${$payloadVariableName} = \$payload;
\$pipeline->next()(\$payload, \$pipeline);
}
}
";
writeToFile($stepFilePath, $stepFileContent);
}
$stepsUsingNamespace = implode(PHP_EOL, $stepsUsingNamespaces);
$stepsDeclaration = implode(PHP_EOL . ' ', $stepsDeclarations);
$stepsReference = implode(PHP_EOL . ' ', $stepsReferences);
$pipelineFileContent = "<?php
declare(strict_types=1);
namespace {$pipelineFullNamespace};
{$stepsUsingNamespace}
use teewurst\\Pipeline\\Pipeline;
class {$pipelineClassName} extends Pipeline
{
public function __construct(
{$stepsDeclaration}
) {
parent::__construct([
{$stepsReference}
]);
}
}
";
writeToFile($pipelineFilePath, $pipelineFileContent);
$payloadFileContent = "<?php
declare(strict_types=1);
namespace {$payloadFullNamespace};
class {$payloadClassName}
{
public function __construct(
#TODO
) {
}
}
";
writeToFile($payloadFilePath, $payloadFileContent);

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 Template\Data\Business\Manager\TemplateEntityManager; use MyTube\Data\Business\Manager\MyTubeEntityManager;
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(TemplateEntityManager::class); $entityManager = $container->get(MyTubeEntityManager::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 Template\Data\Business\Manager\TemplateEntityManager; use MyTube\Data\Business\Manager\MyTubeEntityManager;
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_template_annotation_driver']['paths']; $paths = $doctrineConfig['driver']['orm_myTube_annotation_driver']['paths'];
$dbParams = $doctrineConfig['connection']['orm_template']['params']; $dbParams = $doctrineConfig['connection']['orm_myTube']['params'];
$migrationsConf = $doctrineConfig['migrations_configuration']['orm_template']; $migrationsConf = $doctrineConfig['migrations_configuration']['orm_myTube'];
$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(TemplateEntityManager::class); $entityManager = $container->get(MyTubeEntityManager::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 template-backend composer install drun myTube-backend composer install
# Migrate databases to current version # Migrate databases to current version
drun template-backend composer dmm drun myTube-backend composer dmm
drun template-backend composer dmlm drun myTube-backend composer dmlm
# Insert setup for project after this line # Insert setup for project after this line
drun template-backend composer console rbac:update drun myTube-backend composer console rbac:update
drun template-backend composer console init:data drun myTube-backend composer console init:data

View File

@ -19,50 +19,50 @@
"monolog\/monolog": "^3.4", "monolog\/monolog": "^3.4",
"laminas\/laminas-mail": "^2.23", "laminas\/laminas-mail": "^2.23",
"teewurst\/pipeline": "^3.0", "teewurst\/pipeline": "^3.0",
"guzzlehttp\/guzzle": "^7.8" "guzzlehttp\/guzzle": "^7.8",
"micilini\/video-stream": "*"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Template\\API\\Console\\": "src\/ApiDomain\/Console\/src", "MyTube\\API\\Console\\": "src\/ApiDomain\/Console\/src",
"Template\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src", "MyTube\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src",
"Template\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src", "MyTube\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src",
"Template\\API\\External\\Product\\": "src\/ApiDomain\/External\/Product\/src", "MyTube\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src",
"Template\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src", "MyTube\\Data\\Business\\": "src\/DataDomain\/Business\/src",
"Template\\Data\\Business\\": "src\/DataDomain\/Business\/src", "MyTube\\Data\\Log\\": "src\/DataDomain\/Log\/src",
"Template\\Data\\Log\\": "src\/DataDomain\/Log\/src", "MyTube\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src",
"Template\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src", "MyTube\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src",
"Template\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src", "MyTube\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src",
"Template\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src", "MyTube\\Handling\\User\\": "src\/HandlingDomain\/User\/src",
"Template\\Handling\\User\\": "src\/HandlingDomain\/User\/src", "MyTube\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src",
"Template\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src", "MyTube\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src",
"Template\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src", "MyTube\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src",
"Template\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src", "MyTube\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src",
"Template\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src", "MyTube\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src",
"Template\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src", "MyTube\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src",
"Template\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src", "MyTube\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src",
"Template\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src", "MyTube\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src",
"Template\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src", "MyTube\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src",
"Template\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src", "MyTube\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src",
"Template\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src", "MyTube\\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": {
"Template\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/", "MyTube\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/",
"Template\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/", "MyTube\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/",
"Template\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/", "MyTube\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/",
"Template\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/" "MyTube\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/"
} }
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Template\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/", "MyTube\\API\\%s\\%s\\": "src\/ApiDomain\/{*}\/{*}\/src\/",
"Template\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/", "MyTube\\Data\\%s\\": "src\/DataDomain\/{*}\/src\/",
"Template\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/", "MyTube\\Handling\\%s\\": "src\/HandlingDomain\/{*}\/src\/",
"Template\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/" "MyTube\\Infrastructure\\%s\\": "src\/Infrastructure\/{*}\/src\/"
} }
} }
} }
@ -96,27 +96,26 @@
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Template\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src", "MyTube\\API\\External\\Authentication\\": "src\/ApiDomain\/External\/Authentication\/src",
"Template\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src", "MyTube\\API\\External\\Health\\": "src\/ApiDomain\/External\/Health\/src",
"Template\\API\\External\\Product\\": "src\/ApiDomain\/External\/Product\/src", "MyTube\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src",
"Template\\API\\External\\User\\": "src\/ApiDomain\/External\/User\/src", "MyTube\\Data\\Business\\": "src\/DataDomain\/Business\/src",
"Template\\Data\\Business\\": "src\/DataDomain\/Business\/src", "MyTube\\Data\\Log\\": "src\/DataDomain\/Log\/src",
"Template\\Data\\Log\\": "src\/DataDomain\/Log\/src", "MyTube\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src",
"Template\\Handling\\Product\\": "src\/HandlingDomain\/Product\/src", "MyTube\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src",
"Template\\Handling\\Registration\\": "src\/HandlingDomain\/Registration\/src", "MyTube\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src",
"Template\\Handling\\Role\\": "src\/HandlingDomain\/Role\/src", "MyTube\\Handling\\User\\": "src\/HandlingDomain\/User\/src",
"Template\\Handling\\User\\": "src\/HandlingDomain\/User\/src", "MyTube\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src",
"Template\\Handling\\UserSession\\": "src\/HandlingDomain\/UserSession\/src", "MyTube\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src",
"Template\\Infrastructure\\Database\\": "src\/Infrastructure\/Database\/src", "MyTube\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src",
"Template\\Infrastructure\\DependencyInjection\\": "src\/Infrastructure\/DependencyInjection\/src", "MyTube\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src",
"Template\\Infrastructure\\Encryption\\": "src\/Infrastructure\/Encryption\/src", "MyTube\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src",
"Template\\Infrastructure\\Exception\\": "src\/Infrastructure\/Exception\/src", "MyTube\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src",
"Template\\Infrastructure\\Logging\\": "src\/Infrastructure\/Logging\/src", "MyTube\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src",
"Template\\Infrastructure\\Rbac\\": "src\/Infrastructure\/Rbac\/src", "MyTube\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src",
"Template\\Infrastructure\\Request\\": "src\/Infrastructure\/Request\/src", "MyTube\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src",
"Template\\Infrastructure\\Response\\": "src\/Infrastructure\/Response\/src", "MyTube\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src",
"Template\\Infrastructure\\Session\\": "src\/Infrastructure\/Session\/src", "MyTube\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src"
"Template\\Infrastructure\\UuidGenerator\\": "src\/Infrastructure\/UuidGenerator\/src"
} }
} }
} }

View File

@ -19,29 +19,30 @@
"monolog/monolog": "^3.4", "monolog/monolog": "^3.4",
"laminas/laminas-mail": "^2.23", "laminas/laminas-mail": "^2.23",
"teewurst/pipeline": "^3.0", "teewurst/pipeline": "^3.0",
"guzzlehttp/guzzle": "^7.8" "guzzlehttp/guzzle": "^7.8",
"micilini/video-stream": "^1.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Template\\API\\Console\\": "src/ApiDomain/Console/src/" "MyTube\\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": {
"Template\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/", "MyTube\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/",
"Template\\Data\\%s\\": "src/DataDomain/{*}/src/", "MyTube\\Data\\%s\\": "src/DataDomain/{*}/src/",
"Template\\Handling\\%s\\": "src/HandlingDomain/{*}/src/", "MyTube\\Handling\\%s\\": "src/HandlingDomain/{*}/src/",
"Template\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/" "MyTube\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/"
} }
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Template\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/", "MyTube\\API\\%s\\%s\\": "src/ApiDomain/{*}/{*}/src/",
"Template\\Data\\%s\\": "src/DataDomain/{*}/src/", "MyTube\\Data\\%s\\": "src/DataDomain/{*}/src/",
"Template\\Handling\\%s\\": "src/HandlingDomain/{*}/src/", "MyTube\\Handling\\%s\\": "src/HandlingDomain/{*}/src/",
"Template\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/" "MyTube\\Infrastructure\\%s\\": "src/Infrastructure/{*}/src/"
} }
} }
} }

View File

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

View File

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

View File

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

View File

@ -11,14 +11,14 @@ return [
// `composer clear-config-cache`. // `composer clear-config-cache`.
ConfigAggregator::ENABLE_CACHE => false, ConfigAggregator::ENABLE_CACHE => false,
// Enable debugging; typically used to provide debugging information within templates. // Enable debugging; typically used to provide debugging information within myTubes.
'debug' => false, 'debug' => false,
'mezzio' => [ 'mezzio' => [
// Provide templates for the error handling middleware to use when // Provide myTubes for the error handling middleware to use when
// generating responses. // generating responses.
'error_handler' => [ 'error_handler' => [
'template_404' => 'error::404', 'myTube_404' => 'error::404',
'template_error' => 'error::error', 'myTube_error' => 'error::error',
], ],
], ],
]; ];

View File

@ -40,34 +40,32 @@ $aggregator = new ConfigAggregator([
// Data // Data
\Template\Data\Business\ConfigProvider::class, \MyTube\Data\Business\ConfigProvider::class,
\Template\Data\Log\ConfigProvider::class, \MyTube\Data\Log\ConfigProvider::class,
// Infrastructure // Infrastructure
\Template\Infrastructure\Database\ConfigProvider::class, \MyTube\Infrastructure\Database\ConfigProvider::class,
\Template\Infrastructure\DependencyInjection\ConfigProvider::class, \MyTube\Infrastructure\DependencyInjection\ConfigProvider::class,
\Template\Infrastructure\Encryption\ConfigProvider::class, \MyTube\Infrastructure\Encryption\ConfigProvider::class,
\Template\Infrastructure\Exception\ConfigProvider::class, \MyTube\Infrastructure\Exception\ConfigProvider::class,
\Template\Infrastructure\Logging\ConfigProvider::class, \MyTube\Infrastructure\Logging\ConfigProvider::class,
\Template\Infrastructure\Rbac\ConfigProvider::class, \MyTube\Infrastructure\Rbac\ConfigProvider::class,
\Template\Infrastructure\Request\ConfigProvider::class, \MyTube\Infrastructure\Request\ConfigProvider::class,
\Template\Infrastructure\Session\ConfigProvider::class, \MyTube\Infrastructure\Session\ConfigProvider::class,
// HandlingDomain // HandlingDomain
\Template\Handling\Product\ConfigProvider::class, \MyTube\Handling\User\ConfigProvider::class,
\Template\Handling\User\ConfigProvider::class, \MyTube\Handling\UserSession\ConfigProvider::class,
\Template\Handling\UserSession\ConfigProvider::class, \MyTube\Handling\Registration\ConfigProvider::class,
\Template\Handling\Registration\ConfigProvider::class,
// API // API
/// Command /// Command
\Template\API\Console\ConfigProvider::class, \MyTube\API\Console\ConfigProvider::class,
/// External /// External
\Template\API\External\Health\ConfigProvider::class, \MyTube\API\External\Health\ConfigProvider::class,
\Template\API\External\Product\ConfigProvider::class, \MyTube\API\External\User\ConfigProvider::class,
\Template\API\External\User\ConfigProvider::class, \MyTube\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 Template\Infrastructure\Exception\Middleware\TemplateExceptionHandlerMiddleware; use MyTube\Infrastructure\Exception\Middleware\MyTubeExceptionHandlerMiddleware;
use Template\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware; use MyTube\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware;
use Template\Infrastructure\Session\Middleware\SessionMiddleware; use MyTube\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 Template Space //// Pre MyTube Space
$app->pipe(TemplateExceptionHandlerMiddleware::class); $app->pipe(MyTubeExceptionHandlerMiddleware::class);
$app->pipe(AnalyzeHeaderMiddleware::class); $app->pipe(AnalyzeHeaderMiddleware::class);
//// Template Space //// MyTube 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 Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware; use MyTube\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
/** /**
* laminas-router route configuration * laminas-router route configuration

View File

@ -1,38 +0,0 @@
<?php
declare(strict_types=1);
namespace Template\Migrations\Template;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230922101352 extends AbstractMigration
{
public function getDescription(): string
{
return "Create Table 'product'";
}
public function up(Schema $schema): void
{
$sql = "CREATE TABLE product (
id binary(16) NOT NULL,
identifier varchar(255) UNIQUE NOT NULL,
name varchar(255) DEFAULT NULL,
updated_at datetime NOT NULL,
created_at datetime NOT NULL,
PRIMARY KEY (id)
);";
$this->addSql($sql);
}
public function down(Schema $schema): void
{
$this->addSql("DROP TABLE product;");
}
}

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Template\Migrations\Template;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20231021103120 extends AbstractMigration
{
public function getDescription(): string
{
return 'drop password from registration';
}
public function up(Schema $schema): void
{
$sql = "ALTER TABLE registration DROP COLUMN password;";
$this->addSql($sql);
}
public function down(Schema $schema): void
{
$sql = "ALTER TABLE registration ADD COLUMN password varchar(255) NOT NULL after username";
$this->addSql($sql);
}
}

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Template\Migrations\Template;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20231021112654 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add url to product';
}
public function up(Schema $schema): void
{
$sql = "ALTER TABLE product ADD COLUMN url varchar(255) NULL after name";
$this->addSql($sql);
}
public function down(Schema $schema): void
{
$sql = "ALTER TABLE product DROP COLUMN url;";
$this->addSql($sql);
}
}

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Template\Migrations\Log; namespace MyTube\Migrations\Log;
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 Template\Migrations\Template; namespace MyTube\Migrations\MyTube;
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 Template\Migrations\Template; namespace MyTube\Migrations\MyTube;
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 Template\Migrations\Template; namespace MyTube\Migrations\MyTube;
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 Template\Migrations\Template; namespace MyTube\Migrations\MyTube;
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 Template\Migrations\Template; namespace MyTube\Migrations\MyTube;
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 Template\Migrations\Template; namespace MyTube\Migrations\MyTube;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
@ -23,7 +23,6 @@ final class Version20230924113403 extends AbstractMigration
id binary(16) NOT NULL, id binary(16) NOT NULL,
mail varchar(255) NOT NULL, mail varchar(255) NOT NULL,
username varchar(255) NOT NULL, username varchar(255) NOT NULL,
password varchar(255) NOT NULL,
created_at datetime NOT NULL, created_at datetime NOT NULL,
PRIMARY KEY (id) PRIMARY KEY (id)
);"; );";

View File

@ -1,18 +1,18 @@
version: '3' version: '3'
networks: networks:
template: myTube:
external: true external: true
services: services:
template-backend-mysql: myTube-backend-mysql:
image: template-backend-mysql image: myTube-backend-mysql
networks: networks:
- template - myTube
build: build:
context: ./../ context: ./../
dockerfile: ./docker/mysql/dockerfile dockerfile: ./docker/mysql/dockerfile
volumes: volumes:
- /Users/flo/dev/backend/template/var/db:/var/lib/mysql:z - /Users/flo/dev/backend/myTube/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
template-backend-app: myTube-backend-app:
image: template-backend-app image: myTube-backend-app
networks: networks:
- template - myTube
build: build:
context: ./../ context: ./../
dockerfile: ./docker/php/dockerfile dockerfile: ./docker/php/dockerfile
volumes: volumes:
- /Users/flo/dev/backend/template/:/var/www/html:z - /Users/flo/dev/backend/myTube/:/var/www/html:z
ports: ports:
- 9000:9000 - 9000:9000
depends_on: depends_on:
template-backend-mysql: myTube-backend-mysql:
condition: service_healthy condition: service_healthy
template-backend-nginx: myTube-backend-nginx:
image: template-backend-nginx image: myTube-backend-nginx
networks: networks:
- template - myTube
build: build:
context: ./../ context: ./../
dockerfile: ./docker/nginx/dockerfile dockerfile: ./docker/nginx/dockerfile
ports: ports:
- 8080:80 - 8080:80
depends_on: depends_on:
- template-backend-app - myTube-backend-app

View File

@ -1,13 +1,13 @@
version: '3' version: '3'
networks: networks:
template: mytube:
external: true external: true
services: services:
template-backend-mysql: mytube-backend-mysql:
image: template-backend-mysql image: mytube-backend-mysql
networks: networks:
- template - mytube
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
template-backend-app: mytube-backend-app:
image: template-backend-app image: mytube-backend-app
networks: networks:
- template - mytube
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:
template-backend-mysql: mytube-backend-mysql:
condition: service_healthy condition: service_healthy
template-backend-nginx: mytube-backend-nginx:
image: template-backend-nginx image: mytube-backend-nginx
networks: networks:
- template - mytube
build: build:
context: ./../ context: ./../
dockerfile: ./docker/nginx/dockerfile dockerfile: ./docker/nginx/dockerfile
ports: ports:
- 8080:80 - 8080:80
depends_on: depends_on:
- template-backend-app - mytube-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 `template`; CREATE DATABASE IF NOT EXISTS `myTube`;
GRANT ALL PRIVILEGES on *.* to 'template'@'%'; GRANT ALL PRIVILEGES on *.* to 'myTube'@'%';

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<?php <?php
use Template\API\Console\Command\InitializeDataCommand; use MyTube\API\Console\Command\InitializeDataCommand;
use Template\API\Console\Command\RbacUpdateCommand; use MyTube\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 Template\API\Console\Command; namespace MyTube\API\Console\Command;
use Template\Data\Business\Entity\Role; use MyTube\Data\Business\Entity\Role;
use Template\Data\Business\Entity\User; use MyTube\Data\Business\Entity\User;
use Template\Data\Business\Repository\RoleRepository; use MyTube\Data\Business\Repository\RoleRepository;
use Template\Data\Business\Repository\UserRepository; use MyTube\Data\Business\Repository\UserRepository;
use Template\Data\Business\Manager\TemplateEntityManager; use MyTube\Data\Business\Manager\MyTubeEntityManager;
use Template\Infrastructure\Encryption\Client\EncryptionClient; use MyTube\Infrastructure\Encryption\Client\EncryptionClient;
use Template\Infrastructure\Logging\Logger\Logger; use MyTube\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 TemplateEntityManager $entityManager, private readonly MyTubeEntityManager $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 Template\API\Console\Command; namespace MyTube\API\Console\Command;
use Template\Data\Business\Entity\Permission; use MyTube\Data\Business\Entity\Permission;
use Template\Data\Business\Entity\Role; use MyTube\Data\Business\Entity\Role;
use Template\Data\Business\Repository\PermissionRepository; use MyTube\Data\Business\Repository\PermissionRepository;
use Template\Data\Business\Repository\RoleRepository; use MyTube\Data\Business\Repository\RoleRepository;
use Template\Data\Business\Manager\TemplateEntityManager; use MyTube\Data\Business\Manager\MyTubeEntityManager;
use Template\Infrastructure\Logging\Logger\Logger; use MyTube\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 TemplateEntityManager $entityManager, private readonly MyTubeEntityManager $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('template-rbac')->toArray(); $this->rbacConfig = $this->configService->resolve('myTube-rbac')->toArray();
} }
protected function execute( protected function execute(

View File

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

View File

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

View File

@ -1,9 +1,9 @@
<?php <?php
use Template\API\External\Authentication\Handler\ConfirmRegistrationHandler; use MyTube\API\External\Authentication\Handler\ConfirmRegistrationHandler;
use Template\API\External\Authentication\Handler\LoginUserHandler; use MyTube\API\External\Authentication\Handler\LoginUserHandler;
use Template\API\External\Authentication\Handler\LogoutUserHandler; use MyTube\API\External\Authentication\Handler\LogoutUserHandler;
use Template\API\External\Authentication\Handler\RegisterUserHandler; use MyTube\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 Template\API\External\Authentication; namespace MyTube\API\External\Authentication;
class ConfigProvider class ConfigProvider
{ {

View File

@ -2,12 +2,12 @@
declare(strict_types=1); declare(strict_types=1);
namespace Template\API\External\Authentication\Handler; namespace MyTube\API\External\Authentication\Handler;
use Template\API\External\User\Formatter\UserFormatter; use MyTube\API\External\User\Formatter\UserFormatter;
use Template\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandBuilder; use MyTube\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandBuilder;
use Template\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandHandler; use MyTube\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandHandler;
use Template\Infrastructure\Session\Middleware\SessionMiddleware; use MyTube\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 Template\API\External\Authentication\Handler; namespace MyTube\API\External\Authentication\Handler;
use Template\Handling\UserSession\Handler\Command\LoginUser\LoginUserCommandBuilder; use MyTube\Handling\UserSession\Handler\Command\LoginUser\LoginUserCommandBuilder;
use Template\Handling\UserSession\Handler\Command\LoginUser\LoginUserCommandHandler; use MyTube\Handling\UserSession\Handler\Command\LoginUser\LoginUserCommandHandler;
use Template\Infrastructure\Session\Middleware\SessionMiddleware; use MyTube\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 Template\API\External\Authentication\Handler; namespace MyTube\API\External\Authentication\Handler;
use Template\Handling\UserSession\Handler\Command\LogoutUser\LogoutUserCommandBuilder; use MyTube\Handling\UserSession\Handler\Command\LogoutUser\LogoutUserCommandBuilder;
use Template\Handling\UserSession\Handler\Command\LogoutUser\LogoutUserCommandHandler; use MyTube\Handling\UserSession\Handler\Command\LogoutUser\LogoutUserCommandHandler;
use Template\Infrastructure\Response\SuccessResponse; use MyTube\Infrastructure\Response\SuccessResponse;
use Template\Infrastructure\Session\Middleware\SessionMiddleware; use MyTube\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 Template\API\External\Authentication\Handler; namespace MyTube\API\External\Authentication\Handler;
use Template\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandBuilder; use MyTube\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandBuilder;
use Template\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandHandler; use MyTube\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandHandler;
use Template\Infrastructure\Exception\Middleware\TemplateExceptionHandlerMiddleware; use MyTube\Infrastructure\Exception\Middleware\MyTubeExceptionHandlerMiddleware;
use Template\Infrastructure\Logging\Logger\Logger; use MyTube\Infrastructure\Logging\Logger\Logger;
use Template\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware; use MyTube\Infrastructure\Request\Middleware\AnalyzeHeaderMiddleware;
use Template\Infrastructure\Response\SuccessResponse; use MyTube\Infrastructure\Response\SuccessResponse;
use Template\Infrastructure\Session\Middleware\SessionMiddleware; use MyTube\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 Template\API\External\Health\Handler\HealthHandler; use MyTube\API\External\Health\Handler\HealthHandler;
return [ return [
[ [

View File

@ -1,6 +1,6 @@
<?php <?php
use Template\API\External\Health\Handler\HealthHandler; use MyTube\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 Template\API\External\Health; namespace MyTube\API\External\Health;
class ConfigProvider class ConfigProvider
{ {

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Template\API\External\Health\Handler; namespace MyTube\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,11 +1,11 @@
<?php <?php
use Template\API\External\User\Handler\ChangePasswordHandler; use MyTube\API\External\User\Handler\ChangePasswordHandler;
use Template\API\External\User\Handler\ChangeUsernameHandler; use MyTube\API\External\User\Handler\ChangeUsernameHandler;
use Template\API\External\User\Handler\CreateUserHandler; use MyTube\API\External\User\Handler\CreateUserHandler;
use Template\API\External\User\Handler\UserStateHandler; use MyTube\API\External\User\Handler\UserStateHandler;
use Template\Infrastructure\Rbac\Middleware\EnsureAuthorizationMiddleware; use MyTube\Infrastructure\Rbac\Middleware\EnsureAuthorizationMiddleware;
use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware; use MyTube\Infrastructure\Session\Middleware\LoggedInUserMiddleware;
return [ return [
[ [

View File

@ -1,10 +1,10 @@
<?php <?php
use Template\API\External\User\Formatter\UserFormatter; use MyTube\API\External\User\Formatter\UserFormatter;
use Template\API\External\User\Handler\ChangePasswordHandler; use MyTube\API\External\User\Handler\ChangePasswordHandler;
use Template\API\External\User\Handler\ChangeUsernameHandler; use MyTube\API\External\User\Handler\ChangeUsernameHandler;
use Template\API\External\User\Handler\CreateUserHandler; use MyTube\API\External\User\Handler\CreateUserHandler;
use Template\API\External\User\Handler\UserStateHandler; use MyTube\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 Template\API\External\User; namespace MyTube\API\External\User;
class ConfigProvider class ConfigProvider
{ {

View File

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

View File

@ -2,13 +2,13 @@
declare(strict_types=1); declare(strict_types=1);
namespace Template\API\External\User\Handler; namespace MyTube\API\External\User\Handler;
use Template\Data\Business\Entity\User; use MyTube\Data\Business\Entity\User;
use Template\Handling\User\Handler\Command\ChangePassword\ChangePasswordCommandBuilder; use MyTube\Handling\User\Handler\Command\ChangePassword\ChangePasswordCommandBuilder;
use Template\Handling\User\Handler\Command\ChangePassword\ChangePasswordCommandHandler; use MyTube\Handling\User\Handler\Command\ChangePassword\ChangePasswordCommandHandler;
use Template\Infrastructure\Response\SuccessResponse; use MyTube\Infrastructure\Response\SuccessResponse;
use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware; use MyTube\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 Template\API\External\User\Handler; namespace MyTube\API\External\User\Handler;
use Template\Data\Business\Entity\User; use MyTube\Data\Business\Entity\User;
use Template\Handling\User\Handler\Command\ChangeUsername\ChangeUsernameCommandBuilder; use MyTube\Handling\User\Handler\Command\ChangeUsername\ChangeUsernameCommandBuilder;
use Template\Handling\User\Handler\Command\ChangeUsername\ChangeUsernameCommandHandler; use MyTube\Handling\User\Handler\Command\ChangeUsername\ChangeUsernameCommandHandler;
use Template\Infrastructure\Response\SuccessResponse; use MyTube\Infrastructure\Response\SuccessResponse;
use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware; use MyTube\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 Template\API\External\User\Handler; namespace MyTube\API\External\User\Handler;
use Template\API\External\User\Formatter\UserFormatter; use MyTube\API\External\User\Formatter\UserFormatter;
use Template\Handling\User\Handler\Command\CreateUser\CreateUserCommandBuilder; use MyTube\Handling\User\Handler\Command\CreateUser\CreateUserCommandBuilder;
use Template\Handling\User\Handler\Command\CreateUser\CreateUserCommandHandler; use MyTube\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 Template\API\External\User\Handler; namespace MyTube\API\External\User\Handler;
use Template\API\External\User\Formatter\UserFormatter; use MyTube\API\External\User\Formatter\UserFormatter;
use Template\Data\Business\Entity\User; use MyTube\Data\Business\Entity\User;
use Template\Handling\User\Handler\Command\CreateUser\CreateUserCommandBuilder; use MyTube\Handling\User\Handler\Command\CreateUser\CreateUserCommandBuilder;
use Template\Handling\User\Handler\Command\CreateUser\ChangePasswordCommandHandler; use MyTube\Handling\User\Handler\Command\CreateUser\ChangePasswordCommandHandler;
use Template\Infrastructure\Session\Middleware\LoggedInUserMiddleware; use MyTube\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_template' => [ 'orm_myTube' => [
'second_level_cache' => [ 'second_level_cache' => [
'enabled' => false, 'enabled' => false,
] ]
@ -14,7 +14,7 @@ return [
], ],
'driver' => [ 'driver' => [
'orm_template_annotation_driver' => [ 'orm_myTube_annotation_driver' => [
'class' => AnnotationDriver::class, 'class' => AnnotationDriver::class,
'cache' => 'array', 'cache' => 'array',
'paths' => [ 'paths' => [
@ -22,16 +22,16 @@ return [
], ],
], ],
'orm_template' => [ 'orm_myTube' => [
'class' => MappingDriverChain::class, 'class' => MappingDriverChain::class,
'drivers' => [ 'drivers' => [
'Template\Data\Business\Entity' => 'orm_template_annotation_driver', 'MyTube\Data\Business\Entity' => 'orm_myTube_annotation_driver',
], ],
], ],
], ],
'connection' => [ 'connection' => [
'orm_template' => [ 'orm_myTube' => [
'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_template' => [ 'orm_myTube' => [
'directory' => 'data/migrations/template', 'directory' => 'data/migrations/myTube',
'name' => 'Doctrine Database Migrations for Template', 'name' => 'Doctrine Database Migrations for MyTube',
'namespace' => 'Template\Migrations\Template', 'namespace' => 'MyTube\Migrations\MyTube',
'table' => 'migrations', 'table' => 'migrations',
], ],
], ],

View File

@ -1,21 +1,21 @@
<?php <?php
use Template\Data\Business\Entity\User; use MyTube\Data\Business\Entity\User;
use Template\Data\Business\Factory\TemplateEntityManagerFactory; use MyTube\Data\Business\Factory\MyTubeEntityManagerFactory;
use Template\Data\Business\Manager\TemplateEntityManager; use MyTube\Data\Business\Manager\MyTubeEntityManager;
use Template\Data\Business\Repository\UserRepository; use MyTube\Data\Business\Repository\UserRepository;
use Template\Infrastructure\Database\AutowireRepositoryFactory; use MyTube\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_template' => [EntityManagerFactory::class, 'orm_template'], 'doctrine.entity_manager.orm_myTube' => [EntityManagerFactory::class, 'orm_myTube'],
'doctrine.configuration.orm_template' => [ConfigurationFactory::class, 'orm_template'], 'doctrine.configuration.orm_myTube' => [ConfigurationFactory::class, 'orm_myTube'],
'doctrine.connection.orm_template' => [ConnectionFactory::class, 'orm_template'], 'doctrine.connection.orm_myTube' => [ConnectionFactory::class, 'orm_myTube'],
TemplateEntityManager::class => TemplateEntityManagerFactory::class, MyTubeEntityManager::class => MyTubeEntityManagerFactory::class,
UserRepository::class => [AutowireRepositoryFactory::class, TemplateEntityManager::class, User::class], UserRepository::class => [AutowireRepositoryFactory::class, MyTubeEntityManager::class, User::class],
], ],
]; ];

View File

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

View File

@ -1,15 +1,15 @@
<?php <?php
namespace Template\Data\Business\Entity; namespace MyTube\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 Template\Infrastructure\UuidGenerator\UuidGenerator; use MyTube\Infrastructure\UuidGenerator\UuidGenerator;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
/** /**
* @ORM\Entity(repositoryClass="Template\Data\Business\Repository\PermissionRepository") * @ORM\Entity(repositoryClass="MyTube\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="Template\Data\Business\Entity\Product") * @ORM\OneToOne(targetEntity="MyTube\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="Template\Data\Business\Entity\Role", inversedBy="permissions") * @ORM\ManyToMany(targetEntity="MyTube\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,14 +1,14 @@
<?php <?php
namespace Template\Data\Business\Entity; namespace MyTube\Data\Business\Entity;
use DateTime; use DateTime;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Template\Infrastructure\UuidGenerator\UuidGenerator; use MyTube\Infrastructure\UuidGenerator\UuidGenerator;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
/** /**
* @ORM\Entity(repositoryClass="Template\Data\Business\Repository\RegistrationRepository") * @ORM\Entity(repositoryClass="MyTube\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 Template\Data\Business\Entity; namespace MyTube\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 Template\Infrastructure\UuidGenerator\UuidGenerator; use MyTube\Infrastructure\UuidGenerator\UuidGenerator;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
/** /**
* @ORM\Entity(repositoryClass="Template\Data\Business\Repository\RoleRepository") * @ORM\Entity(repositoryClass="MyTube\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="Template\Data\Business\Entity\Product") * @ORM\OneToOne(targetEntity="MyTube\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="Template\Data\Business\Entity\Permission", mappedBy="roles") * @ORM\ManyToMany(targetEntity="MyTube\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 Template\Data\Business\Entity; namespace MyTube\Data\Business\Entity;
use DateTime; use DateTime;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Template\Infrastructure\UuidGenerator\UuidGenerator; use MyTube\Infrastructure\UuidGenerator\UuidGenerator;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
/** /**
* @ORM\Entity(repositoryClass="Template\Data\Business\Repository\UserRepository") * @ORM\Entity(repositoryClass="MyTube\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="Template\Data\Business\Entity\Role") * @ORM\OneToOne(targetEntity="MyTube\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="Template\Data\Business\Entity\UserSession", mappedBy="user") */ /** @ORM\OneToOne(targetEntity="MyTube\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 Template\Data\Business\Entity; namespace MyTube\Data\Business\Entity;
use DateTime; use DateTime;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Template\Infrastructure\UuidGenerator\UuidGenerator; use MyTube\Infrastructure\UuidGenerator\UuidGenerator;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
/** /**
* @ORM\Entity(repositoryClass="Template\Data\Business\Repository\UserSessionRepository") * @ORM\Entity(repositoryClass="MyTube\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="Template\Data\Business\Entity\User", mappedBy="session") * @ORM\OneToOne(targetEntity="MyTube\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

@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace MyTube\Data\Business\Factory;
use MyTube\Data\Business\Manager\MyTubeEntityManager;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Psr\Container\ContainerInterface;
class MyTubeEntityManagerFactory implements FactoryInterface
{
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): MyTubeEntityManager
{
return new MyTubeEntityManager(
$container->get('doctrine.entity_manager.orm_myTube')
);
}
}

View File

@ -1,19 +0,0 @@
<?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

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

View File

@ -1,11 +0,0 @@
<?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 Template\Data\Business\Repository; namespace MyTube\Data\Business\Repository;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;

View File

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

View File

@ -1,8 +1,8 @@
<?php <?php
namespace Template\Data\Business\Repository; namespace MyTube\Data\Business\Repository;
use Template\Data\Business\Entity\Registration; use MyTube\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 Template\Data\Business\Repository; namespace MyTube\Data\Business\Repository;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;

View File

@ -1,8 +1,8 @@
<?php <?php
namespace Template\Data\Business\Repository; namespace MyTube\Data\Business\Repository;
use Template\Data\Business\Entity\User; use MyTube\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 Template\Data\Business\Repository; namespace MyTube\Data\Business\Repository;
use Template\Data\Business\Entity\User; use MyTube\Data\Business\Entity\User;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Template\Data\Business\Entity\UserSession; use MyTube\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' => [
'Template\Data\Log\Entity' => 'orm_log_annotation_driver', 'MyTube\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' => 'Template\Migrations\Log', 'namespace' => 'MyTube\Migrations\Log',
'table' => 'migrations', 'table' => 'migrations',
], ],
], ],

View File

@ -1,7 +1,7 @@
<?php <?php
use Template\Data\Log\Factory\LogEntityManagerFactory; use MyTube\Data\Log\Factory\LogEntityManagerFactory;
use Template\Data\Log\Manager\LogEntityManager; use MyTube\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 Template\Data\Log; namespace MyTube\Data\Log;
class ConfigProvider class ConfigProvider
{ {

View File

@ -1,15 +1,15 @@
<?php <?php
namespace Template\Data\Log\Entity; namespace MyTube\Data\Log\Entity;
use DateTime; use DateTime;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Template\Infrastructure\UuidGenerator\UuidGenerator; use MyTube\Infrastructure\UuidGenerator\UuidGenerator;
use Ramsey\Uuid\UuidInterface; use Ramsey\Uuid\UuidInterface;
/** /**
* Member * Member
* @ORM\Entity(repositoryClass="Template\Data\Log\Repository\LogRepository") * @ORM\Entity(repositoryClass="MyTube\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 Template\Data\Log\Factory; namespace MyTube\Data\Log\Factory;
use Template\Data\Log\Manager\LogEntityManager; use MyTube\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 Template\Data\Log\Manager; namespace MyTube\Data\Log\Manager;
use Doctrine\ORM\Decorator\EntityManagerDecorator; use Doctrine\ORM\Decorator\EntityManagerDecorator;

View File

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

View File

@ -1,43 +0,0 @@
<?php
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;
return [
'factories' => [
/// Builder
ProductBuilder::class => AutoWiringFactory::class,
/// Rule
ProductIdentifierAlreadyExistsRule::class => InjectionFactory::class,
/// CQRS
// Product List
ProductListQueryHandler::class => InjectionFactory::class,
ProductListQueryBuilder::class => AutoWiringFactory::class,
// Create Product
CreateProductCommandHandler::class => AutoWiringFactory::class,
CreateProductCommandBuilder::class => AutoWiringFactory::class,
// Delete Product
DeleteProductCommandHandler::class => InjectionFactory::class,
DeleteProductCommandBuilder::class => AutoWiringFactory::class,
// Update Product
UpdateProductCommandHandler::class => InjectionFactory::class,
UpdateProductCommandBuilder::class => AutoWiringFactory::class,
],
];

View File

@ -1,23 +0,0 @@
<?php
namespace Template\Handling\Product\Builder;
use Template\Data\Business\Entity\Product;
class ProductBuilder
{
public function build(
string $identifier,
?string $name,
?string $url
): Product
{
$product = new Product();
$product->setIdentifier($identifier);
$product->setName($name);
$product->setUrl($url);
return $product;
}
}

View File

@ -1,15 +0,0 @@
<?php
declare(strict_types=1);
namespace Template\Handling\Product;
class ConfigProvider
{
public function __invoke(): array
{
return [
'dependencies' => require __DIR__ . '/./../config/service_manager.php',
];
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace Template\Handling\Product\Exception;
use Template\Infrastructure\Exception\ErrorCode;
use Template\Infrastructure\Exception\ErrorDomain;
use Template\Infrastructure\Exception\Exception\TemplateException;
use Ramsey\Uuid\UuidInterface;
class ProductNotFoundByIdException extends TemplateException {
private const MESSAGE = 'The product with the Id %s was not found!';
public function __construct(UuidInterface $id)
{
parent::__construct(
sprintf(
self::MESSAGE,
$id->toString()
),
ErrorDomain::Product,
ErrorCode::NotFound
);
}
}
?>

View File

@ -1,24 +0,0 @@
<?php
namespace Template\Handling\Product\Exception;
use Template\Infrastructure\Exception\ErrorCode;
use Template\Infrastructure\Exception\ErrorDomain;
use Template\Infrastructure\Exception\Exception\TemplateException;
class ProductWithIdentifierAlreadyExists extends TemplateException {
private const MESSAGE = 'A product with the identifier %s does already exist!';
public function __construct(string $identifier)
{
parent::__construct(
sprintf(
self::MESSAGE,
$identifier
),
ErrorDomain::Product,
ErrorCode::AlreadyExists
);
}
}

View File

@ -1,22 +0,0 @@
<?php
namespace Template\Handling\Product\Handler\Command\CreateProduct;
class CreateProductCommand
{
public function __construct(
private readonly string $identifier,
private readonly ?string $name,
) {
}
public function getIdentifier(): string {
return $this->identifier;
}
public function getName(): ?string {
return $this->name;
}
}
?>

View File

@ -1,17 +0,0 @@
<?php
namespace Template\Handling\Product\Handler\Command\CreateProduct;
class CreateProductCommandBuilder
{
public function build(
string $identifier,
?string $name
): CreateProductCommand
{
return new CreateProductCommand(
$identifier,
$name
);
}
}

View File

@ -1,34 +0,0 @@
<?php
namespace Template\Handling\Product\Handler\Command\CreateProduct;
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 TemplateEntityManager $entityManager,
private readonly ProductIdentifierAlreadyExistsRule $productIdentifierAlreadyExistsRule,
private readonly ProductBuilder $builder,
) {
}
public function execute(CreateProductCommand $command): Product
{
$this->productIdentifierAlreadyExistsRule->appliesTo($command->getIdentifier());
$product = $this->builder->build(
identifier: $command->getIdentifier(),
name: $command->getName(),
url: null,
);
$this->entityManager->persist($product);
$this->entityManager->flush();
return $product;
}
}

View File

@ -1,19 +0,0 @@
<?php
namespace Template\Handling\Product\Handler\Command\DeleteProduct;
use Ramsey\Uuid\UuidInterface;
class DeleteProductCommand
{
public function __construct(
private readonly UuidInterface $id
) {
}
public function getId(): UuidInterface {
return $this->id;
}
}
?>

View File

@ -1,19 +0,0 @@
<?php
namespace Template\Handling\Product\Handler\Command\DeleteProduct;
use Ramsey\Uuid\Uuid;
class DeleteProductCommandBuilder
{
public function build(
string $id
): DeleteProductCommand
{
return new DeleteProductCommand(
id: Uuid::fromString($id)
);
}
}
?>

View File

@ -1,39 +0,0 @@
<?php
namespace Template\Handling\Product\Handler\Command\DeleteProduct;
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("Template\Data\Business\Manager\TemplateEntityManager")
* @InjectDoctrineRepository(
* entityManager="Template\Data\Business\Manager\TemplateEntityManager",
* entity="Template\Data\Business\Entity\Product"
* )
*/
public function __construct(
private readonly TemplateEntityManager $entityManager,
private readonly ProductRepository $repository,
) {
}
public function execute(DeleteProductCommand $command): void
{
$product = $this->repository->find(
$command->getId()
) ?? null;
if ($product === null) {
throw new ProductNotFoundByIdException($command->getId());
}
$this->entityManager->remove($product);
$this->entityManager->flush();
}
}

View File

@ -1,32 +0,0 @@
<?php
namespace Template\Handling\Product\Handler\Command\UpdateProduct;
use Ramsey\Uuid\UuidInterface;
class UpdateProductCommand
{
public function __construct(
private readonly UuidInterface $id,
private readonly string $identifier,
private readonly ?string $name,
private readonly ?string $url,
) {
}
public function getId(): UuidInterface {
return $this->id;
}
public function getIdentifier(): string {
return $this->identifier;
}
public function getName(): ?string {
return $this->name;
}
public function getUrl(): ?string {
return $this->url;
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace Template\Handling\Product\Handler\Command\UpdateProduct;
use Ramsey\Uuid\Uuid;
class UpdateProductCommandBuilder
{
public function build(
string $id,
string $identifier,
?string $name,
?string $url,
): UpdateProductCommand
{
return new UpdateProductCommand(
id: Uuid::fromString($id),
identifier: $identifier,
name: $name,
url: $url === '' ? null : $url,
);
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace Template\Handling\Product\Handler\Command\UpdateProduct;
use DateTime;
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("Template\Data\Business\Manager\TemplateEntityManager")
* @InjectDoctrineRepository(
* entityManager="Template\Data\Business\Manager\TemplateEntityManager",
* entity="Template\Data\Business\Entity\Product"
* )
* @Inject("Template\Handling\Product\Rule\ProductIdentifierAlreadyExistsRule")
*/
public function __construct(
private readonly TemplateEntityManager $entityManager,
private readonly ProductRepository $repository,
private readonly ProductIdentifierAlreadyExistsRule $productIdentifierAlreadyExistsRule,
) {
}
public function execute(UpdateProductCommand $command): Product
{
$id = $command->getId();
/** @var Product $product */
$product = $this->repository->find($id) ?? null;
if ($product === null) {
throw new ProductNotFoundByIdException($id);
}
if ($product->getId()->toString() !== $command->getId()->toString()) {
$this->productIdentifierAlreadyExistsRule->appliesTo($command->getIdentifier());
}
$product->setIdentifier($command->getIdentifier());
$product->setName($command->getName());
$product->setUrl($command->getUrl());
$product->setUpdatedAt(new DateTime());
$this->entityManager->persist($product);
$this->entityManager->flush();
return $product;
}
}

View File

@ -1,17 +0,0 @@
<?php
namespace Template\Handling\Product\Handler\Query\ProductList;
class ProductListQuery
{
public function __construct(
private readonly string $query
) {
}
public function getQuery(): string {
return $this->query;
}
}
?>

View File

@ -1,21 +0,0 @@
<?php
namespace Template\Handling\Product\Handler\Query\ProductList;
class ProductListQueryBuilder
{
public function __construct(
) {
}
public function build(
string $query
): ProductListQuery
{
return new ProductListQuery(
$query
);
}
}
?>

View File

@ -1,29 +0,0 @@
<?php
namespace Template\Handling\Product\Handler\Query\ProductList;
use Template\Data\Business\Entity\Product;
use Template\Data\Business\Repository\ProductRepository;
use Template\Data\Business\Manager\TemplateEntityManager;
use Reinfi\DependencyInjection\Annotation\InjectDoctrineRepository;
class ProductListQueryHandler
{
/**
* @InjectDoctrineRepository(
* entityManager="Template\Data\Business\Manager\TemplateEntityManager",
* entity="Template\Data\Business\Entity\Product"
* )
*/
public function __construct(
private readonly ProductRepository $repository,
) {
}
public function execute(ProductListQuery $query): array
{
return $this->repository->findAll();
}
}
?>

View File

@ -1,33 +0,0 @@
<?php
namespace Template\Handling\Product\Rule;
use Template\Data\Business\Entity\Product;
use Template\Data\Business\Repository\ProductRepository;
use Template\Handling\Product\Exception\ProductWithIdentifierAlreadyExists;
use Template\Data\Business\Manager\TemplateEntityManager;
use Reinfi\DependencyInjection\Annotation\InjectDoctrineRepository;
class ProductIdentifierAlreadyExistsRule
{
/**
* @InjectDoctrineRepository(
* entityManager="Template\Data\Business\Manager\TemplateEntityManager",
* entity="Template\Data\Business\Entity\Product"
* )
*/
public function __construct(
private readonly ProductRepository $productRepository
) {
}
public function appliesTo(string $identifier) {
$product = $this->productRepository->findOneBy([
'identifier' => $identifier
]) ?? null;
if ($product !== null) {
throw new ProductWithIdentifierAlreadyExists($identifier);
}
}
}

View File

@ -1,20 +1,20 @@
<?php <?php
use Template\Handling\Registration\Builder\RegistrationBuilder; use MyTube\Handling\Registration\Builder\RegistrationBuilder;
use Template\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandBuilder; use MyTube\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandBuilder;
use Template\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandHandler; use MyTube\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommandHandler;
use Template\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandBuilder; use MyTube\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandBuilder;
use Template\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandHandler; use MyTube\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommandHandler;
use Template\Handling\Registration\Pipeline\ConfirmRegistration\ConfirmRegistrationPipeline; use MyTube\Handling\Registration\Pipeline\ConfirmRegistration\ConfirmRegistrationPipeline;
use Template\Handling\Registration\Pipeline\ConfirmRegistration\Step\CreateUserStep; use MyTube\Handling\Registration\Pipeline\ConfirmRegistration\Step\CreateUserStep;
use Template\Handling\Registration\Pipeline\ConfirmRegistration\Step\LoadRegistrationStep; use MyTube\Handling\Registration\Pipeline\ConfirmRegistration\Step\LoadRegistrationStep;
use Template\Handling\Registration\Pipeline\ConfirmRegistration\Step\SaveRegistrationAndUserStep; use MyTube\Handling\Registration\Pipeline\ConfirmRegistration\Step\SaveRegistrationAndUserStep;
use Template\Handling\Registration\Pipeline\RegisterUser\RegisterUserPipeline; use MyTube\Handling\Registration\Pipeline\RegisterUser\RegisterUserPipeline;
use Template\Handling\Registration\Pipeline\RegisterUser\Step\BuildRegistrationStep; use MyTube\Handling\Registration\Pipeline\RegisterUser\Step\BuildRegistrationStep;
use Template\Handling\Registration\Pipeline\RegisterUser\Step\CheckIdentifierStep; use MyTube\Handling\Registration\Pipeline\RegisterUser\Step\CheckIdentifierStep;
use Template\Handling\Registration\Pipeline\RegisterUser\Step\SaveRegistrationStep; use MyTube\Handling\Registration\Pipeline\RegisterUser\Step\SaveRegistrationStep;
use Template\Handling\Registration\Pipeline\RegisterUser\Step\SendMailStep; use MyTube\Handling\Registration\Pipeline\RegisterUser\Step\SendMailStep;
use Template\Handling\Registration\Rule\RegistrationWithIdentifierAlreadyExistsRule; use MyTube\Handling\Registration\Rule\RegistrationWithIdentifierAlreadyExistsRule;
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 Template\Handling\Registration\Builder; namespace MyTube\Handling\Registration\Builder;
use Template\Data\Business\Entity\Registration; use MyTube\Data\Business\Entity\Registration;
class RegistrationBuilder class RegistrationBuilder
{ {

View File

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

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