diff --git a/composer.json b/composer.json index ec265f8..24fd9f8 100644 --- a/composer.json +++ b/composer.json @@ -46,6 +46,7 @@ "ext-gd": "*", "ext-json": "*", "dotkernel/dot-annotated-services": "^4.1.7", + "dotkernel/dot-cache": "^4.0", "dotkernel/dot-cli": "^3.5.0", "dotkernel/dot-data-fixtures": "^1.1.3", "dotkernel/dot-doctrine-metadata": "^3.2.2", diff --git a/config/autoload/doctrine.global.php b/config/autoload/doctrine.global.php index 1367b23..d5f8816 100644 --- a/config/autoload/doctrine.global.php +++ b/config/autoload/doctrine.global.php @@ -2,8 +2,11 @@ declare(strict_types=1); +use Api\App\Entity\EntityListenerResolver; use Doctrine\ORM\Mapping\Driver\AttributeDriver; use Doctrine\Persistence\Mapping\Driver\MappingDriverChain; +use Dot\Cache\Adapter\ArrayAdapter; +use Dot\Cache\Adapter\FilesystemAdapter; use Ramsey\Uuid\Doctrine\UuidBinaryOrderedTimeType; use Ramsey\Uuid\Doctrine\UuidBinaryType; use Ramsey\Uuid\Doctrine\UuidType; @@ -49,6 +52,32 @@ UuidBinaryOrderedTimeType::NAME => UuidBinaryOrderedTimeType::class, ], 'fixtures' => getcwd() . '/data/doctrine/fixtures', + 'configuration' => [ + 'orm_default' => [ + 'entity_listener_resolver' => EntityListenerResolver::class, + 'result_cache' => 'filesystem', + 'metadata_cache' => 'filesystem', + 'query_cache' => 'filesystem', + 'hydration_cache' => 'array', + 'second_level_cache' => [ + 'enabled' => true, + 'default_lifetime' => 3600, + 'default_lock_lifetime' => 60, + 'file_lock_region_directory' => '', + 'regions' => [], + ], + ], + ], + 'cache' => [ + 'array' => [ + 'class' => ArrayAdapter::class, + ], + 'filesystem' => [ + 'class' => FilesystemAdapter::class, + 'directory' => getcwd() . '/data/cache', + 'namespace' => 'doctrine', + ], + ], ], 'resultCacheLifetime' => 3600, ]; diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index 70bdf3e..3f4fb5d 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -51,11 +51,6 @@ return [ 'params' => $databases['default'], ], ], - 'configuration' => [ - 'orm_default' => [ - 'entity_listener_resolver' => EntityListenerResolver::class, - ], - ], ], 'uploads' => [ 'user' => [ diff --git a/config/config.php b/config/config.php index 7e67358..76254c5 100644 --- a/config/config.php +++ b/config/config.php @@ -49,6 +49,7 @@ class_exists(Mezzio\Tooling\ConfigProvider::class) Dot\ResponseHeader\ConfigProvider::class, Dot\Mail\ConfigProvider::class, Dot\DataFixtures\ConfigProvider::class, + Dot\Cache\ConfigProvider::class, // Default App module config Api\Admin\ConfigProvider::class,