Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b8d62d8
Deprecate ClassMetadataFactory::setMetadataFor()
GromNaN Oct 30, 2025
0550eef
Make AbstractManagerRegistry::$proxyInterfaceName nullable
GromNaN Oct 29, 2025
ae937ca
Merge pull request #461 from GromNaN/deprecate-setMetadataFor
greg0ire Nov 3, 2025
b3bf81a
Bump doctrine/.github from 12.1.0 to 12.2.0
dependabot[bot] Nov 3, 2025
0d23334
Merge pull request #475 from doctrine/dependabot/github_actions/3.4.x…
greg0ire Nov 3, 2025
7ea41a8
Backport static analysis fix
VincentLanglet Nov 4, 2025
98daf9a
Merge pull request #476 from VincentLanglet/fixCovariant
greg0ire Nov 4, 2025
ad1dc76
Merge pull request #458 from GromNaN/nullable-proxyInterfaceName
greg0ire Nov 5, 2025
b5dab12
Bump doctrine/.github/.github/workflows/phpstan.yml
dependabot[bot] Nov 24, 2025
3957ae2
Bump doctrine/.github/.github/workflows/documentation.yml
dependabot[bot] Nov 24, 2025
eb52fff
Merge pull request #482 from doctrine/dependabot/github_actions/3.4.x…
greg0ire Nov 24, 2025
2f3ffb0
Merge pull request #481 from doctrine/dependabot/github_actions/3.4.x…
greg0ire Nov 24, 2025
4e91a07
Bump doctrine/.github/.github/workflows/release-on-milestone-closed.y…
dependabot[bot] Nov 24, 2025
5457688
Bump doctrine/.github/.github/workflows/coding-standards.yml (#479)
dependabot[bot] Nov 24, 2025
51521de
Bump doctrine/.github/.github/workflows/continuous-integration.yml (#…
dependabot[bot] Nov 24, 2025
4fd46d1
Add support for Symfony 8 (#477)
loic425 Nov 24, 2025
229cb07
Merge remote-tracking branch 'origin/3.4.x' into 4.1.x
greg0ire Dec 4, 2025
f7deb22
Merge pull request #483 from greg0ire/4.1.x
greg0ire Dec 4, 2025
318b574
Merge pull request #484 from doctrine/4.1.x
greg0ire Dec 4, 2025
602d04b
Merge remote-tracking branch 'upstream/4.2.x' into merge-4-into-5
GromNaN Dec 4, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ on:
jobs:
coding-standards:
name: "Coding Standards"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@12.1.0"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@13.1.0"
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
phpunit:
name: "PHPUnit"
uses: "doctrine/.github/.github/workflows/continuous-integration.yml@12.1.0"
uses: "doctrine/.github/.github/workflows/continuous-integration.yml@13.1.0"
with:
php-versions: '["8.4", "8.5"]'
phpunit-options-lowest: "--do-not-fail-on-deprecation"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ on:
jobs:
documentation:
name: "Documentation"
uses: "doctrine/.github/.github/workflows/documentation.yml@12.2.0"
uses: "doctrine/.github/.github/workflows/documentation.yml@13.1.0"
2 changes: 1 addition & 1 deletion .github/workflows/release-on-milestone-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
release:
name: "Git tag, release & create merge-up PR"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@12.1.0"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@13.1.0"
secrets:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ on:
jobs:
static-analysis:
name: "Static Analysis"
uses: "doctrine/.github/.github/workflows/phpstan.yml@12.1.0"
uses: "doctrine/.github/.github/workflows/phpstan.yml@13.1.0"
5 changes: 5 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ return function (ClassMetadata $metadata): void {
};
```

## Do not pass any proxy interface to `AbstractManagerRegistry` when using native proxies

With PHP 8.4 native lazy objects, you don't need to pass any proxy interface to
`AbstractManagerRegistry`. The class of the lazy objects is the class being mapped.

# Upgrade to 4.0

## BC Break: Removed `StaticReflectionService`
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"phpstan/phpstan-strict-rules": "^2",
"doctrine/coding-standard": "^14",
"phpunit/phpunit": "^10.5.58 || ^12",
"symfony/cache": "^4.4 || ^5.4 || ^6.0 || ^7.0",
"symfony/finder": "^4.4 || ^5.4 || ^6.0 || ^7.0"
"symfony/cache": "^4.4 || ^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/finder": "^4.4 || ^5.4 || ^6.0 || ^7.0 || ^8.0"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 3 additions & 1 deletion docs/en/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,12 @@ your mapped PHP classes.
public function getAllMetadata();
public function getMetadataFor($className);
public function hasMetadataFor($className);
public function setMetadataFor($className, $class);
public function setMetadataFor($className, $class); // Deprecated
public function isTransient($className);
}

The method ``setMetadataFor()`` is deprecated and should not be used.

Mapping Driver
==============

Expand Down
2 changes: 1 addition & 1 deletion src/AbstractManagerRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry
/**
* @param array<string, string> $connections
* @param array<string, string> $managers
* @phpstan-param class-string|null $proxyInterfaceName
* @phpstan-param class-string|null $proxyInterfaceName Set to null when native lazy objects are used.
*/
public function __construct(
private readonly string $name,
Expand Down
2 changes: 1 addition & 1 deletion src/Mapping/AbstractClassMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public function hasMetadataFor(string $className): bool
/**
* Sets the metadata descriptor for a specific class.
*
* NOTE: This is only useful in very special cases, like when generating proxy classes.
* @deprecated Since 4.2, use a custom ClassMetadataFactory implementation if you need to set metadata manually.
*
* @phpstan-param class-string $className
* @phpstan-param CMTemplate $class
Expand Down
2 changes: 2 additions & 0 deletions src/Mapping/ClassMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public function hasMetadataFor(string $className): bool;
/**
* Sets the metadata descriptor for a specific class.
*
* @deprecated Since 4.2, use a custom ClassMetadataFactory implementation if you need to set metadata manually.
*
* @param class-string $className
* @phpstan-param T $class
*/
Expand Down
53 changes: 51 additions & 2 deletions tests/ManagerRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ public function testGetManagerForClass(): void
);
}

public function testGetManagerForClassAnonymous(): void
{
$anonymousClass = new class extends TestObject implements Proxy {
public function __isInitialized(): bool
{
return true;
}

public function __load(): void
{
}
};

self::assertNull($this->mr->getManagerForClass($anonymousClass::class));
}

public function testGetManagerForProxiedClass(): void
{
self::assertInstanceOf(
Expand All @@ -64,6 +80,39 @@ public function testGetManagerForAnonymousClass(): void
})::class));
}

public function testGetManagerForWithoutProxyInterface(): void
{
$mr = new TestManagerRegistry(
'ORM',
['default' => 'default_connection'],
['default' => 'default_manager'],
'default',
'default',
null,
$this->getManagerFactory(),
);

self::assertInstanceOf(
ObjectManager::class,
$mr->getManagerForClass(TestObject::class),
);

self::assertNull($mr->getManagerForClass(TestObjectProxy::class));

$anonymousClass = new class extends TestObject implements Proxy {
public function __isInitialized(): bool
{
return true;
}

public function __load(): void
{
}
};

self::assertNull($mr->getManagerForClass($anonymousClass::class));
}

public function testResetManager(): void
{
$manager = $this->mr->getManager();
Expand Down Expand Up @@ -179,15 +228,15 @@ class TestManagerRegistry extends AbstractManagerRegistry
/**
* {@inheritDoc}
*
* @phpstan-param class-string $proxyInterfaceName
* @phpstan-param class-string|null $proxyInterfaceName
*/
public function __construct(
string $name,
array $connections,
array $managers,
string $defaultConnection,
string $defaultManager,
string $proxyInterfaceName,
string|null $proxyInterfaceName,
callable $managerFactory,
) {
$this->managerFactory = $managerFactory;
Expand Down