[PR #1071] [MERGED] Setup::createConfiguration breaks Cache interface contract #9118

Closed
opened 2026-01-22 16:03:16 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/1071
Author: @VasekPurchart
Created: 6/25/2014
Status: Merged
Merged: 6/26/2014
Merged by: @Ocramius

Base: masterHead: fix-setup-cache


📝 Commits (1)

  • ee5f465 set namespace in setup only on CacheProvider instances

📊 Changes

2 files changed (+19 additions, -1 deletions)

View changed files

📝 lib/Doctrine/ORM/Tools/Setup.php (+4 -1)
📝 tests/Doctrine/Tests/ORM/Tools/SetupTest.php (+15 -0)

📄 Description

Method setNamespace is called in Setup::createConfiguration, but at the moment there can be an instance of Doctrine\Common\Cache\Cache (when given in the 3rd parameter), which does not define this method. This method is defined in Doctrine\Common\Cache\CacheProvider from which are the defaults being instantiated in this method extended.

So there should be an condition (as proposed in this PR now) or the 3rd parameter should declare a dependency on CacheProvider rather than just Cache interface. Or maybe the namespace should be set only if the Cache instance is not given by the 3rd parameter, assuming that when someone is giving a ready instance of Cache, it is configured properly.

If you want to take another approach, I can change this PR.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/1071 **Author:** [@VasekPurchart](https://github.com/VasekPurchart) **Created:** 6/25/2014 **Status:** ✅ Merged **Merged:** 6/26/2014 **Merged by:** [@Ocramius](https://github.com/Ocramius) **Base:** `master` ← **Head:** `fix-setup-cache` --- ### 📝 Commits (1) - [`ee5f465`](https://github.com/doctrine/orm/commit/ee5f465a2febd7986b839ebdea9ead0b0ef66cb3) set namespace in setup only on CacheProvider instances ### 📊 Changes **2 files changed** (+19 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/Tools/Setup.php` (+4 -1) 📝 `tests/Doctrine/Tests/ORM/Tools/SetupTest.php` (+15 -0) </details> ### 📄 Description Method `setNamespace` is called in `Setup::createConfiguration`, but at the moment there can be an instance of `Doctrine\Common\Cache\Cache` (when given in the 3rd parameter), which does not define this method. This method is defined in `Doctrine\Common\Cache\CacheProvider` from which are the defaults being instantiated in this method extended. So there should be an condition (as proposed in this PR now) or the 3rd parameter should declare a dependency on `CacheProvider` rather than just `Cache` interface. Or maybe the namespace should be set only if the Cache instance is not given by the 3rd parameter, assuming that when someone is giving a ready instance of Cache, it is configured properly. If you want to take another approach, I can change this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 16:03:16 +01:00
admin closed this issue 2026-01-22 16:03:16 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9118