Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
},
"require": {
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"dotkernel/dot-cache": "^4.0",
"ramsey/uuid": "^4.5.0",
"ramsey/uuid-doctrine": "^2.1.0",
"roave/psr-container-doctrine": "^5.2.2 || ^6.0.0",
"dotkernel/dot-errorhandler": "^4.4.0",
"laminas/laminas-component-installer": "^3.5.0",
"laminas/laminas-config-aggregator": "^1.17.0",
"mezzio/mezzio": "^3.24.0",
"mezzio/mezzio-fastroute": "^3.13.0",
"mezzio/mezzio-twigrenderer": "^2.17.0",
"dotkernel/dot-cache": "^4.0",
"ramsey/uuid": "^4.5.0",
"ramsey/uuid-doctrine": "^2.1.0",
"roave/psr-container-doctrine": "^5.2.2"
"mezzio/mezzio-twigrenderer": "^2.17.0"
},
"require-dev": {
"filp/whoops": "^2.17.0",
Expand All @@ -47,8 +47,7 @@
"phpunit/phpunit": "^10.5.45",
"roave/security-advisories": "dev-master",
"symfony/var-dumper": "^7.2.3",
"vincentlanglet/twig-cs-fixer": "^3.5.1",
"phpstan/phpstan-doctrine": "^2.0.3"
"vincentlanglet/twig-cs-fixer": "^3.5.1"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion config/autoload/local.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
];

return [
'databases' => $databases,
'databases' => $databases,
'doctrine' => [
'connection' => [
'orm_default' => [
Expand Down
79 changes: 67 additions & 12 deletions src/App/src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,78 @@

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\EntityListenerResolver as EntityListenerResolverInterface;
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use Dot\Cache\Adapter\ArrayAdapter;
use Dot\Cache\Adapter\FilesystemAdapter;
use Light\App\Factory\GetIndexViewHandlerFactory;
use Light\App\Handler\GetIndexViewHandler;
use Mezzio\Application;
use Ramsey\Uuid\Doctrine\UuidBinaryOrderedTimeType;
use Ramsey\Uuid\Doctrine\UuidBinaryType;
use Ramsey\Uuid\Doctrine\UuidType;
use Roave\PsrContainerDoctrine\EntityManagerFactory;
use Symfony\Component\Cache\Adapter\AdapterInterface;

use function getcwd;

/**
* @phpstan-type ConfigType array{
* dependencies: DependenciesType,
* doctrine: DoctrineConfigType,
* resultCacheLifetime: int,
* }
* @phpstan-type DoctrineConfigType array{
* cache: array{
* array: array{
* class: class-string<AdapterInterface>,
* },
* filesystem: array{
* class: class-string<AdapterInterface>,
* directory: non-empty-string,
* namespace: non-empty-string,
* },
* },
* configuration: array{
* orm_default: array{
* entity_listener_resolver: class-string<EntityListenerResolverInterface>,
* result_cache: non-empty-string,
* metadata_cache: non-empty-string,
* query_cache: non-empty-string,
* hydration_cache: non-empty-string,
* typed_field_mapper: non-empty-string|null,
* second_level_cache: array{
* enabled: bool,
* default_lifetime: int,
* default_lock_lifetime: int,
* file_lock_region_directory: string,
* regions: string[],
* },
* },
* },
* driver: array{
* orm_default: array{
* class: class-string<MappingDriver>,
* },
* },
* migrations: array{
* migrations_paths: array<non-empty-string, non-empty-string>,
* all_or_nothing: bool,
* check_database_platform: bool,
* },
* types: array<non-empty-string, class-string>,
* }
* @phpstan-type DependenciesType array{
* factories: array<class-string|non-empty-string, class-string|non-empty-string>,
* aliases: array<class-string|non-empty-string, class-string|non-empty-string>,
* }
*/

class ConfigProvider
{
/**
@return array{
* dependencies: array<mixed>,
* doctrine: array<mixed>,
* templates: array<mixed>,
* }
*/
Expand All @@ -37,10 +91,7 @@ public function __invoke(): array
}

/**
* @return array{
* delegators: array<class-string, array<class-string>>,
* factories: array<class-string, class-string>,
* }
* @return DependenciesType
*/
public function getDependencies(): array
{
Expand Down Expand Up @@ -83,6 +134,9 @@ public function getTemplates(): array
];
}

/**
* @return DoctrineConfigType
*/
private function getDoctrineConfig(): array
{
return [
Expand All @@ -98,12 +152,13 @@ private function getDoctrineConfig(): array
],
'configuration' => [
'orm_default' => [
'result_cache' => 'filesystem',
'metadata_cache' => 'filesystem',
'query_cache' => 'filesystem',
'hydration_cache' => 'array',
'typed_field_mapper' => null,
'second_level_cache' => [
'entity_listener_resolver' => EntityListenerResolverInterface::class,
'result_cache' => 'filesystem',
'metadata_cache' => 'filesystem',
'query_cache' => 'filesystem',
'hydration_cache' => 'array',
'typed_field_mapper' => null,
'second_level_cache' => [
'enabled' => true,
'default_lifetime' => 3600,
'default_lock_lifetime' => 60,
Expand Down