Error thrown when setting up Doctrine ORM #6776

Closed
opened 2026-01-22 15:38:24 +01:00 by admin · 24 comments
Owner

Originally created by @filiptrplan on GitHub (Jul 2, 2021).

On a freshly installed Doctrine ORM I tried to setup the EntityManager like so:

use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
require_once __DIR__ . '/../../vendor/autoload.php';

$isDevMode = true;
$proxyDir = null;
$cache = null;
$useSimpleAnnotationReader = false;
$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__ . "/entities"), $isDevMode, $proxyDir, $cache, $useSimpleAnnotationReader);
// or if you prefer yaml or XML
// $config = Setup::createXMLMetadataConfiguration(array(__DIR__."/config/xml"), $isDevMode);
// $config = Setup::createYAMLMetadataConfiguration(array(__DIR__."/config/yaml"), $isDevMode);

// database configuration parameters
$conn = array(
    'driver' => 'mysql',
    'user' => 'something',
    'passwords' => 'other',
    'dbname' => 'itsadb',
    'host' => 'localhost'
);
$em = EntityManager::create($conn, $config);

Only to get the following error:

[02-Jul-2021 16:07:30 Europe/Berlin] PHP Fatal error:  Uncaught RuntimeException: Setup tool cannot configure caches without doctrine/cache 1.11 or symfony/cache. Please add an explicit dependency to either library. in C:\xampp\htdocs\iPoint\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php:184
Stack trace:
#0 C:\xampp\htdocs\iPoint\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php(160): Doctrine\ORM\Tools\Setup::createCacheInstance(true, NULL)
#1 C:\xampp\htdocs\iPoint\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php(139): Doctrine\ORM\Tools\Setup::createCacheConfiguration(true, 'C:\\Users\\FILIP~...', NULL)
#2 C:\xampp\htdocs\iPoint\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php(87): Doctrine\ORM\Tools\Setup::createConfiguration(true, 'C:\\Users\\FILIP~...', NULL)
#3 C:\xampp\htdocs\iPoint\php\doctrine\bootstrap.php(16): Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(Array, true, NULL, NULL, false)
#4 C:\xampp\htdocs\iPoint\php\test.php(5): getEntityManager()
#5 {main}
  thrown in C:\xampp\htdocs\iPoint\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php on line 184

My composer.json:

{
    "require": {
        "stripe/stripe-php": "^7.86",
        "facebook/graph-sdk": "^5.7",
        "google/apiclient": "2.10",
        "symfony/yaml": "2.*",
        "doctrine/orm": "^2.9"
    }
}

I also tried installing the symfony/cache and doctrine/cache packages separately with composer require but I got the same error.

I'm running PHP version 7.3.28

This should be the piece of code throwing the exception:

if (! class_exists(ArrayCache::class) && ! class_exists(ArrayAdapter::class)) {
    throw new RuntimeException('Setup tool cannot configure caches without doctrine/cache 1.11 or symfony/cache. Please add an explicit dependency to either library.');
}

My IDE also highlights those classes and some others as missing.
image
image
image

Originally created by @filiptrplan on GitHub (Jul 2, 2021). On a freshly installed Doctrine ORM I tried to setup the EntityManager like so: ```php use Doctrine\ORM\Tools\Setup; use Doctrine\ORM\EntityManager; require_once __DIR__ . '/../../vendor/autoload.php'; $isDevMode = true; $proxyDir = null; $cache = null; $useSimpleAnnotationReader = false; $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__ . "/entities"), $isDevMode, $proxyDir, $cache, $useSimpleAnnotationReader); // or if you prefer yaml or XML // $config = Setup::createXMLMetadataConfiguration(array(__DIR__."/config/xml"), $isDevMode); // $config = Setup::createYAMLMetadataConfiguration(array(__DIR__."/config/yaml"), $isDevMode); // database configuration parameters $conn = array( 'driver' => 'mysql', 'user' => 'something', 'passwords' => 'other', 'dbname' => 'itsadb', 'host' => 'localhost' ); $em = EntityManager::create($conn, $config); ``` Only to get the following error: ``` [02-Jul-2021 16:07:30 Europe/Berlin] PHP Fatal error: Uncaught RuntimeException: Setup tool cannot configure caches without doctrine/cache 1.11 or symfony/cache. Please add an explicit dependency to either library. in C:\xampp\htdocs\iPoint\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php:184 Stack trace: #0 C:\xampp\htdocs\iPoint\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php(160): Doctrine\ORM\Tools\Setup::createCacheInstance(true, NULL) #1 C:\xampp\htdocs\iPoint\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php(139): Doctrine\ORM\Tools\Setup::createCacheConfiguration(true, 'C:\\Users\\FILIP~...', NULL) #2 C:\xampp\htdocs\iPoint\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php(87): Doctrine\ORM\Tools\Setup::createConfiguration(true, 'C:\\Users\\FILIP~...', NULL) #3 C:\xampp\htdocs\iPoint\php\doctrine\bootstrap.php(16): Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(Array, true, NULL, NULL, false) #4 C:\xampp\htdocs\iPoint\php\test.php(5): getEntityManager() #5 {main} thrown in C:\xampp\htdocs\iPoint\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php on line 184 ``` My composer.json: ``` { "require": { "stripe/stripe-php": "^7.86", "facebook/graph-sdk": "^5.7", "google/apiclient": "2.10", "symfony/yaml": "2.*", "doctrine/orm": "^2.9" } } ``` I also tried installing the `symfony/cache` and `doctrine/cache` packages separately with `composer require` but I got the same error. I'm running PHP version 7.3.28 This should be the piece of code throwing the exception: ```php if (! class_exists(ArrayCache::class) && ! class_exists(ArrayAdapter::class)) { throw new RuntimeException('Setup tool cannot configure caches without doctrine/cache 1.11 or symfony/cache. Please add an explicit dependency to either library.'); } ``` My IDE also highlights those classes and some others as missing. ![image](https://user-images.githubusercontent.com/8643457/124290674-04407100-db54-11eb-92ce-5a1b3e5695cd.png) ![image](https://user-images.githubusercontent.com/8643457/124290682-060a3480-db54-11eb-86c2-c15366ee3edf.png) ![image](https://user-images.githubusercontent.com/8643457/124290686-073b6180-db54-11eb-877d-57c117324ebb.png)
admin closed this issue 2026-01-22 15:38:25 +01:00
Author
Owner

@greg0ire commented on GitHub (Jul 2, 2021):

Can you find either class in your vendor directory or not?

@greg0ire commented on GitHub (Jul 2, 2021): Can you find either class in your vendor directory or not?
Author
Owner

@filiptrplan commented on GitHub (Jul 2, 2021):

Can you find either class in your vendor directory or not?

After some browsing, I couldn't locate them either. Seems like a dependency issue but I've got no idea how to solve it.

@filiptrplan commented on GitHub (Jul 2, 2021): > Can you find either class in your vendor directory or not? After some browsing, I couldn't locate them either. Seems like a dependency issue but I've got no idea how to solve it.
Author
Owner

@greg0ire commented on GitHub (Jul 2, 2021):

If you cannot locate them, then I'm afraid your composer require did not work at all. What did it say?

@greg0ire commented on GitHub (Jul 2, 2021): If you cannot locate them, then I'm afraid your `composer require` did not work at all. What did it say?
Author
Owner

@filiptrplan commented on GitHub (Jul 3, 2021):

But there are only some of the classes missing. Just the ones I
screenshotted. Some other cache classes have been installed. I also tried
updating composer and reinstalling everything. Can you maybe try composer
install with my composer.json and see if it works?

On Fri, Jul 2, 2021, 20:49 Grégoire Paris @.***> wrote:

If you cannot locate them, then I'm afraid your composer require did not
work at all. What did it say?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/orm/issues/8809#issuecomment-873195995, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/ACB6HAOZC6IBVLYKCKVVHD3TVYC4VANCNFSM47W3HFAA
.

@filiptrplan commented on GitHub (Jul 3, 2021): But there are only some of the classes missing. Just the ones I screenshotted. Some other cache classes have been installed. I also tried updating composer and reinstalling everything. Can you maybe try composer install with my composer.json and see if it works? On Fri, Jul 2, 2021, 20:49 Grégoire Paris ***@***.***> wrote: > If you cannot locate them, then I'm afraid your composer require did not > work at all. What did it say? > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/doctrine/orm/issues/8809#issuecomment-873195995>, or > unsubscribe > <https://github.com/notifications/unsubscribe-auth/ACB6HAOZC6IBVLYKCKVVHD3TVYC4VANCNFSM47W3HFAA> > . >
Author
Owner

@greg0ire commented on GitHub (Jul 3, 2021):

Sure, why not?

@greg0ire commented on GitHub (Jul 3, 2021): Sure, why not?
Author
Owner

@greg0ire commented on GitHub (Jul 3, 2021):

Well, it works for me after installing symfony/cache. Be wary that doctrine/cache 2 is just an empty shell, because doctrine/cache is being sunset.

@greg0ire commented on GitHub (Jul 3, 2021): Well, it works for me after installing `symfony/cache`. Be wary that `doctrine/cache` 2 is just an empty shell, because `doctrine/cache` is being sunset.
Author
Owner

@filiptrplan commented on GitHub (Jul 4, 2021):

Well, it works for me after installing symfony/cache. Be wary that doctrine/cache 2 is just an empty shell, because doctrine/cache is being sunset.

Could you post the composer.json that works for you? I'll try to wipe the vendor folder and cache and install it again with a working composer.json.

@filiptrplan commented on GitHub (Jul 4, 2021): > Well, it works for me after installing `symfony/cache`. Be wary that `doctrine/cache` 2 is just an empty shell, because `doctrine/cache` is being sunset. Could you post the composer.json that works for you? I'll try to wipe the vendor folder and cache and install it again with a working composer.json.
Author
Owner

@greg0ire commented on GitHub (Jul 4, 2021):

Here you go:

{
    "require": {
        "stripe/stripe-php": "^7.86",
        "facebook/graph-sdk": "^5.7",
        "google/apiclient": "2.10",
        "symfony/yaml": "2.*",
        "doctrine/orm": "^2.9",
        "symfony/cache": "^5.3"
    }
}
@greg0ire commented on GitHub (Jul 4, 2021): Here you go: ``` { "require": { "stripe/stripe-php": "^7.86", "facebook/graph-sdk": "^5.7", "google/apiclient": "2.10", "symfony/yaml": "2.*", "doctrine/orm": "^2.9", "symfony/cache": "^5.3" } } ```
Author
Owner

@dopeh commented on GitHub (Aug 3, 2021):

I'm running into the same issue while on doctrine/orm v2.9.3. My composer upgraded doctrine/cache to v2.1 (from v1.11.3) as this is allowed in the composer.json of doctrine/orm (https://github.com/doctrine/orm/blob/2.9.x/composer.json#L24).

But doctrine/cache v2.1 is incompatible with doctrine/orm v2.9.3 because of the hard-check on ArrayCache (see https://github.com/doctrine/orm/blob/2.9.x/lib/Doctrine/ORM/Tools/Setup.php#L183), which class has been removed from doctrine/cache v2.1.

My current work-around is to add an extra constraint on doctrine/cache v1 but it seems to me doctrine/orm v2.9 should not be marked as compatible with doctrine/cache v2.1 to prevent this upgrade from happening.

@dopeh commented on GitHub (Aug 3, 2021): I'm running into the same issue while on doctrine/orm v2.9.3. My composer upgraded doctrine/cache to v2.1 (from v1.11.3) as this is allowed in the composer.json of doctrine/orm (https://github.com/doctrine/orm/blob/2.9.x/composer.json#L24). But doctrine/cache v2.1 is incompatible with doctrine/orm v2.9.3 because of the hard-check on `ArrayCache` (see https://github.com/doctrine/orm/blob/2.9.x/lib/Doctrine/ORM/Tools/Setup.php#L183), which class has been removed from doctrine/cache v2.1. My current work-around is to add an extra constraint on doctrine/cache v1 but it seems to me doctrine/orm v2.9 should not be marked as compatible with doctrine/cache v2.1 to prevent this upgrade from happening.
Author
Owner

@greg0ire commented on GitHub (Aug 3, 2021):

hard-check on ArrayCache

The check is about class existence, so, not sure what a hard check is, but there for sure isn't a hard dependency here. What is supposed to happen is symfony/cache (or any other implementation of the PSR ?) is supposed to take over if you install doctrine/cache v2

I would still love to get a piece of code that reliably reproduces the issue.

@greg0ire commented on GitHub (Aug 3, 2021): > hard-check on ArrayCache The check is about class existence, so, not sure what a hard check is, but there for sure isn't a hard dependency here. What is supposed to happen is `symfony/cache` (or any other implementation of the PSR ?) is supposed to take over if you install `doctrine/cache` v2 I would still love to get a piece of code that reliably reproduces the issue.
Author
Owner

@filiptrplan commented on GitHub (Aug 3, 2021):

It's not a dependency, but it is used in the code.

On Tue, Aug 3, 2021, 18:03 Grégoire Paris @.***> wrote:

hard-check on ArrayCache

The check is about class existence, so, not sure what a hard check is, but
there for sure isn't a hard dependency here.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/orm/issues/8809#issuecomment-891969727, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/ACB6HAIFZ2WLIKJO3IDS6HTT3AHN7ANCNFSM47W3HFAA
.

@filiptrplan commented on GitHub (Aug 3, 2021): It's not a dependency, but it is used in the code. On Tue, Aug 3, 2021, 18:03 Grégoire Paris ***@***.***> wrote: > hard-check on ArrayCache > > The check is about class existence, so, not sure what a hard check is, but > there for sure isn't a hard dependency here. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/doctrine/orm/issues/8809#issuecomment-891969727>, or > unsubscribe > <https://github.com/notifications/unsubscribe-auth/ACB6HAIFZ2WLIKJO3IDS6HTT3AHN7ANCNFSM47W3HFAA> > . >
Author
Owner

@greg0ire commented on GitHub (Aug 3, 2021):

… in a class_exists() call, right?

@greg0ire commented on GitHub (Aug 3, 2021): … in a `class_exists()` call, right?
Author
Owner

@filiptrplan commented on GitHub (Aug 4, 2021):

… in a class_exists() call, right?

Yeah, it throws an exception if it doesn't exist. That's the reason for the error.

@filiptrplan commented on GitHub (Aug 4, 2021): > … in a `class_exists()` call, right? Yeah, it throws an exception if it doesn't exist. That's the reason for the error.
Author
Owner

@greg0ire commented on GitHub (Aug 4, 2021):

It does so as a way to detect if you have doctrine/common 1, or symfony/cache installed. If neither is installed, it throws with a very explicit error message. If this does not work as expected, please provide a repository on github that allows to reproduce your issue reliably.

@greg0ire commented on GitHub (Aug 4, 2021): It does so as a way to detect if you have doctrine/common 1, or symfony/cache installed. If neither is installed, it throws with a very explicit error message. If this does not work as expected, please provide a repository on github that allows to reproduce your issue reliably.
Author
Owner

@dopeh commented on GitHub (Aug 4, 2021):

I would argue that, in fact, it is a hard dependency. The class_exists() call isn't, but because it throws a RuntimeException if it doesn't exist.
I think filiptrplan is using the Getting started example on the doctrine website, which is now broken (https://www.doctrine-project.org/projects/doctrine-orm/en/2.9/tutorials/getting-started.html#obtaining-the-entitymanager). You can't call Setup::createYAMLMetadataConfiguration if doctrine/cache 2.1 is loaded, because it will always throw a RuntimeException as the ArrayCache class does not exist, even if you don't use it yourself. So you would need to manually pin doctrine/cache to a compatible version, even for the example to work.

In addition, any existing projects also run into this, where they are being upgraded to an incompatible doctrine/cache version while still on the same ORM version. Perhaps it makes sense to keep this doctrine/cache upgrade to a next major/minor release for doctrine/orm because it breaks existing code (even the examples).

Edit: I just tried running the example from the docs in a clean project, and can confirm that no longer works. Since it does not pin a specific version of the cache, it will download doctrine/cache v2.1 causing the Setup::createYAMLMetadataConfiguration() to throw the RuntimeException. So I think there is a real issue if even the examples on the website no longer work out of the box.

@dopeh commented on GitHub (Aug 4, 2021): I would argue that, in fact, it is a hard dependency. The ``class_exists()`` call isn't, but because it throws a RuntimeException if it doesn't exist. I think filiptrplan is using the Getting started example on the doctrine website, which is now broken (https://www.doctrine-project.org/projects/doctrine-orm/en/2.9/tutorials/getting-started.html#obtaining-the-entitymanager). You can't call ``Setup::createYAMLMetadataConfiguration`` if doctrine/cache 2.1 is loaded, because it will always throw a RuntimeException as the ArrayCache class does not exist, even if you don't use it yourself. So you would need to manually pin doctrine/cache to a compatible version, even for the example to work. In addition, any existing projects also run into this, where they are being upgraded to an incompatible doctrine/cache version while still on the same ORM version. Perhaps it makes sense to keep this doctrine/cache upgrade to a next major/minor release for doctrine/orm because it breaks existing code (even the examples). Edit: I just tried running the example from the docs in a clean project, and can confirm that no longer works. Since it does not pin a specific version of the cache, it will download doctrine/cache v2.1 causing the ``Setup::createYAMLMetadataConfiguration()`` to throw the RuntimeException. So I think there is a real issue if even the examples on the website no longer work out of the box.
Author
Owner

@greg0ire commented on GitHub (Aug 4, 2021):

I just tried running the example from the docs in a clean project, and can confirm that no longer works.

Please push that project on a public github repo.

@greg0ire commented on GitHub (Aug 4, 2021): > I just tried running the example from the docs in a clean project, and can confirm that no longer works. Please push that project on a public github repo.
Author
Owner

@dopeh commented on GitHub (Aug 4, 2021):

See https://github.com/dopeh/doctrine-orm-example

The actual hard dependency is here I think. If no cache is provided, doctrine/orm v2.9 will automatically load an ArrayCache when setting up. This is currently prevented by the class_exists check, which is good, but then an alternative should be loaded from doctrine/cache 2.1 I think.

@dopeh commented on GitHub (Aug 4, 2021): See https://github.com/dopeh/doctrine-orm-example The actual hard dependency is [here](https://github.com/doctrine/orm/blob/055b646d9a280d77e6deda8eb38f55b0c25a6090/lib/Doctrine/ORM/Tools/Setup.php#L212) I think. If no cache is provided, doctrine/orm v2.9 will automatically load an ArrayCache when setting up. This is currently prevented by the class_exists check, which is good, but then an alternative should be loaded from doctrine/cache 2.1 I think.
Author
Owner

@greg0ire commented on GitHub (Aug 4, 2021):

Ah thanks a lot, I should be able to take a look later :)

From what I gather, the issue might be that https://github.com/doctrine/orm/blob/2.9.x/UPGRADE.md#minor-bc-break-setup-tool-needs-cache-implementation is not sufficient and that the official docs need to be upgraded too.

Does applying https://github.com/doctrine/orm/blob/2.9.x/UPGRADE.md#minor-bc-break-setup-tool-needs-cache-implementation fix your issue?

@greg0ire commented on GitHub (Aug 4, 2021): Ah thanks a lot, I should be able to take a look later :) From what I gather, the issue might be that https://github.com/doctrine/orm/blob/2.9.x/UPGRADE.md#minor-bc-break-setup-tool-needs-cache-implementation is not sufficient and that the official docs need to be upgraded too. Does applying https://github.com/doctrine/orm/blob/2.9.x/UPGRADE.md#minor-bc-break-setup-tool-needs-cache-implementation fix your issue?
Author
Owner

@greg0ire commented on GitHub (Aug 4, 2021):

Ok so I tried your example repository. I'm getting the following crash

Setup tool cannot configure caches without doctrine/cache 1.11 or symfony/cache. Please add an explicit dependency to either library. in /tmp/doctrine-orm-example/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php:184

I have read the error message. Now, let's compare it with what's installed.

composer show |grep cache
doctrine/cache                       2.1.1     PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.
psr/cache                            3.0.0     Common interface for caching libraries

Indeed, I have doctrine/cache, but v2, and I don't have symfony/cache. I deserve this error message.

The next steps are clear to me: I should either downgrade to doctrine/cache, or, and that's better, install symfony/cache (with composer require symfony/cache)

After doing so, there is no crash anymore.

Is any of this unclear to anyone here?

In case you want to experience the absence of crash for yourself, I made a PR at https://github.com/dopeh/doctrine-orm-example/pull/1

This is currently prevented by the class_exists check, which is good, but then an alternative should be loaded from doctrine/cache 2.1 I think.

👍 That might be possible without explicitly recommending symfony/cache, by requiring psr/cache-implementation from doctrine/cache. Let me do a PR with that.

@greg0ire commented on GitHub (Aug 4, 2021): Ok so I tried your example repository. I'm getting the following crash > Setup tool cannot configure caches without doctrine/cache 1.11 or symfony/cache. Please add an explicit dependency to either library. in /tmp/doctrine-orm-example/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Setup.php:184 I have read the error message. Now, let's compare it with what's installed. ``` composer show |grep cache doctrine/cache 2.1.1 PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others. psr/cache 3.0.0 Common interface for caching libraries ``` Indeed, I have `doctrine/cache`, but v2, and I don't have `symfony/cache`. I deserve this error message. The next steps are clear to me: I should either downgrade to `doctrine/cache`, or, and that's better, install `symfony/cache` (with `composer require symfony/cache`) After doing so, there is no crash anymore. Is any of this unclear to anyone here? In case you want to experience the absence of crash for yourself, I made a PR at https://github.com/dopeh/doctrine-orm-example/pull/1 > This is currently prevented by the class_exists check, which is good, but then an alternative should be loaded from doctrine/cache 2.1 I think. 👍 That might be possible without explicitly recommending `symfony/cache`, by requiring `psr/cache-implementation` from `doctrine/cache`. Let me do a PR with that.
Author
Owner

@greg0ire commented on GitHub (Aug 4, 2021):

+1 That might be possible without explicitly recommending symfony/cache, by requiring psr/cache-implementation from doctrine/cache. Let me do a PR with that.

Actually no, bad idea, it would solve your specific issue because the SetupTool can work with either doctrine/cache v1 or symfony/cache, but not with another psr/cache-implementation package.

@greg0ire commented on GitHub (Aug 4, 2021): > +1 That might be possible without explicitly recommending symfony/cache, by requiring psr/cache-implementation from doctrine/cache. Let me do a PR with that. Actually no, bad idea, it would solve your specific issue because the SetupTool can work with either `doctrine/cache` v1 or `symfony/cache`, but not with another `psr/cache-implementation` package.
Author
Owner

@dopeh commented on GitHub (Aug 4, 2021):

Indeed, I have doctrine/cache, but v2, and I don't have symfony/cache. I deserve this error message.

To be fair, a new developer starting a new project with doctrine/orm from scratch does not deserve that.

Please note that the code in my repo was a copy/paste from the getting started docs located here, no more than that. The current Getting Started example from the documentation doesn't work, and instead requires the developer to read an error message and fix it manually by including an extra package (or downgrading one). I don't believe that's a good introduction to an excellent project that doctrine/orm is.

I understand you are trying to stay away of being dependent on a cache dependency, while one is still needed for setting up. So I don't have any other suggestion to fix this, except for applying your proposed PR against the getting started docs instead (https://github.com/doctrine/orm/pull/8883).

@dopeh commented on GitHub (Aug 4, 2021): > Indeed, I have doctrine/cache, but v2, and I don't have symfony/cache. I deserve this error message. To be fair, a new developer starting a new project with doctrine/orm from scratch does not deserve that. Please note that the code in my repo was a copy/paste from the getting started docs located [here](https://github.com/doctrine/orm/blob/2.9.x/docs/en/tutorials/getting-started.rst), no more than that. The current Getting Started example from the documentation doesn't work, and instead requires the developer to read an error message and fix it manually by including an extra package (or downgrading one). I don't believe that's a good introduction to an excellent project that doctrine/orm is. I understand you are trying to stay away of being dependent on a cache dependency, while one is still needed for setting up. So I don't have any other suggestion to fix this, except for applying your proposed PR against the getting started docs instead (https://github.com/doctrine/orm/pull/8883).
Author
Owner

@grzeczko commented on GitHub (Sep 9, 2021):

In your composer.json, add the following:
"doctrine/cache": "~1.11.3",

@grzeczko commented on GitHub (Sep 9, 2021): In your composer.json, add the following: `"doctrine/cache": "~1.11.3",`
Author
Owner

@abass-dev commented on GitHub (Sep 11, 2021):

It works for me!

{
    "require": {
        "doctrine/orm": "^2.9",
        "doctrine/cache": "1.11",
        "symfony/yaml": "^5.3"
    },
    "autoload": {
        "psr-0": {
            "": "src/"
        }
    }
}

The error is already explained when you have typed a command
E.g: bash ./vendor/bin/doctrine list
Fatal error: Uncaught RuntimeException: Setup tool cannot configure caches without doctrine/cache 1.11

@abass-dev commented on GitHub (Sep 11, 2021): It works for me! ```json { "require": { "doctrine/orm": "^2.9", "doctrine/cache": "1.11", "symfony/yaml": "^5.3" }, "autoload": { "psr-0": { "": "src/" } } } ``` The error is already explained when you have typed a command E.g: ```bash ./vendor/bin/doctrine list ``` Fatal error: Uncaught RuntimeException: Setup tool cannot configure caches without doctrine/cache 1.11
Author
Owner

@J4bbi commented on GitHub (Oct 27, 2021):

I came here as a dev that rarely uses php and ran into exactly these confusing problems.

I started the docs to set up a simple boilerplate orm setup with mariadb. The online html tutorial isn't in sync with the rst so still more faff.

@J4bbi commented on GitHub (Oct 27, 2021): I came here as a dev that rarely uses php and ran into exactly these confusing problems. I started the docs to set up a simple boilerplate orm setup with mariadb. The [online html tutorial](https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/tutorials/getting-started.html) isn't in sync with the [rst](https://github.com/doctrine/orm/blob/2.9.x/docs/en/tutorials/getting-started.rst) so still more faff.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6776