Skip to content

Commit 1276ed0

Browse files
W0rmanicolas-grekas
authored andcommitted
Add possibility to set reportFieldsWhereDeclared to true in ORMSetup (doctrine#10865)
Otherwise it is impossible to avoid a deprecation warning when using ORMSetup::createAttributeMetadataConfiguration()
1 parent 6c65843 commit 1276ed0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

docs/en/reference/advanced-configuration.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ steps of configuration.
2929
3030
$config = new Configuration;
3131
$config->setMetadataCache($metadataCache);
32-
$driverImpl = new AttributeDriver(['/path/to/lib/MyProject/Entities']);
32+
$driverImpl = new AttributeDriver(['/path/to/lib/MyProject/Entities'], true);
3333
$config->setMetadataDriverImpl($driverImpl);
3434
$config->setQueryCache($queryCache);
3535
$config->setProxyDir('/path/to/myproject/lib/MyProject/Proxies');
@@ -134,7 +134,7 @@ The attribute driver can be injected in the ``Doctrine\ORM\Configuration``:
134134
<?php
135135
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
136136
137-
$driverImpl = new AttributeDriver(['/path/to/lib/MyProject/Entities']);
137+
$driverImpl = new AttributeDriver(['/path/to/lib/MyProject/Entities'], true);
138138
$config->setMetadataDriverImpl($driverImpl);
139139
140140
The path information to the entities is required for the attribute

lib/Doctrine/ORM/ORMSetup.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ public static function createAttributeMetadataConfiguration(
101101
array $paths,
102102
bool $isDevMode = false,
103103
?string $proxyDir = null,
104-
?CacheItemPoolInterface $cache = null
104+
?CacheItemPoolInterface $cache = null,
105+
bool $reportFieldsWhereDeclared = false
105106
): Configuration {
106107
$config = self::createConfiguration($isDevMode, $proxyDir, $cache);
107-
$config->setMetadataDriverImpl(new AttributeDriver($paths));
108+
$config->setMetadataDriverImpl(new AttributeDriver($paths, $reportFieldsWhereDeclared));
108109

109110
return $config;
110111
}

0 commit comments

Comments
 (0)