{"record":{"id":"b09d9caf8febed4b","repo":"doctrine/orm","slug":"the-doctrine-setup-tool-cannot-configure-caches-wi","errorCode":null,"errorMessage":"The Doctrine setup tool cannot configure caches without symfony/cache. Please add symfony/cache as explicit dependency or pass your own cache implementation.","messagePattern":"The Doctrine setup tool cannot configure caches without symfony/cache\\. Please add symfony/cache as explicit dependency or pass your own cache implementation\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/ORMSetup.php","lineNumber":181,"sourceCode":"        $config = new Configuration();\n        $config->setMetadataCache($cache);\n        $config->setQueryCache($cache);\n        $config->setResultCache($cache);\n\n        return $config;\n    }\n\n    private static function createCacheInstance(\n        bool $isDevMode,\n        string|null $cacheNamespaceSeed,\n        CacheItemPoolInterface|null $cache,\n    ): CacheItemPoolInterface {\n        if ($cache !== null) {\n            return $cache;\n        }\n\n        if (! class_exists(ArrayAdapter::class)) {\n            throw new RuntimeException(\n                'The Doctrine setup tool cannot configure caches without symfony/cache.'\n                . ' Please add symfony/cache as explicit dependency or pass your own cache implementation.',\n            );\n        }\n\n        if ($isDevMode) {\n            return new ArrayAdapter();\n        }\n\n        $namespace = 'dc2_' . md5($cacheNamespaceSeed ?? 'default');\n\n        if (extension_loaded('apcu') && apcu_enabled()) {\n            return new ApcuAdapter($namespace);\n        }\n\n        if (MemcachedAdapter::isSupported()) {\n            return new MemcachedAdapter(MemcachedAdapter::createConnection('memcached://127.0.0.1'), $namespace);\n        }","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/doctrine/orm/blob/d9b9ff73016bf598ae07515f97289ce8074e97a5/src/ORMSetup.php#L163-L199","documentation":"ORMSetup::createAttributeMetadataConfiguration() (and the XML/YAML variants) need a PSR-6 cache; when you pass cache: null the setup tool tries to build one from symfony/cache (ArrayAdapter in dev mode, APCu/Filesystem in production). If the symfony/cache package is not installed, it throws this RuntimeException instead of silently running uncached.","triggerScenarios":"ORMSetup::createAttributeMetadataConfiguration($paths, $devMode) without the optional $cache argument while symfony/cache is absent from composer dependencies; slim project templates that require doctrine/orm but not symfony/cache.","commonSituations":"New projects or microservice builds adding doctrine/orm alone; upgrading where the cache argument changed; Symfony framework apps normally have symfony/cache already, so this bites standalone Silex/Slim/CLI tooling.","solutions":["composer require symfony/cache","Or pass your own PSR-6 pool as the cache argument: ORMSetup::createAttributeMetadataConfiguration($paths, $devMode, proxyDir, $myCachePool)","In Symfony full-stack apps, let the framework bundle configure the ORM instead of calling ORMSetup directly"],"exampleFix":"// before\n$config = ORMSetup::createAttributeMetadataConfiguration([__DIR__.'/src/Entity'], true);\n// throws: symfony/cache missing\n\n// after\n// composer require symfony/cache\n// or:\n$config = ORMSetup::createAttributeMetadataConfiguration(\n    [__DIR__.'/src/Entity'], true, null, new MyPsr6Pool()\n);","handlingStrategy":"validation","validationCode":"if (! class_exists(\\Symfony\\Component\\Cache\\Adapter::class)) {\n    throw new RuntimeException('Run: composer require symfony/cache');\n}\n$config = ORMSetup::createAttributeMetadataConfiguration($paths, $devMode);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Require symfony/cache in composer.json or always pass an explicit PSR-6 pool","Assert cache configuration in a bootstrap/health check","Pin the cache decision in one factory so every entry point uses it"],"tags":["composer-dependency","cache","orm-setup","symfony-cache"],"backgroundTag":"missing-composer-dependency","analyzedSha":"d9b9ff73016bf598ae07515f97289ce8074e97a5","analyzedAt":"2026-08-21T06:13:15.863Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}