Skip to content

Commit 722ce8a

Browse files
committed
[doctrineGH-8471] Deprecate Partial DQL syntax and forcing partial loads.
1 parent 6fe388a commit 722ce8a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/Doctrine/ORM/Query/Parser.php

+7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
namespace Doctrine\ORM\Query;
2222

23+
use Doctrine\Deprecations\Deprecation;
2324
use Doctrine\ORM\EntityManager;
2425
use Doctrine\ORM\Mapping\ClassMetadata;
2526
use Doctrine\ORM\Query;
@@ -1870,6 +1871,12 @@ public function JoinAssociationDeclaration()
18701871
*/
18711872
public function PartialObjectExpression()
18721873
{
1874+
Deprecation::trigger(
1875+
'doctrine/orm',
1876+
'https://github.com/doctrine/orm/issues/8471',
1877+
'PARTIAL syntax in DQL is deprecated.'
1878+
);
1879+
18731880
$this->match(Lexer::T_PARTIAL);
18741881

18751882
$partialFieldSet = [];

lib/Doctrine/ORM/UnitOfWork.php

+8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Doctrine\Common\Collections\Collection;
2525
use Doctrine\Common\EventManager;
2626
use Doctrine\DBAL\LockMode;
27+
use Doctrine\Deprecations\Deprecation;
2728
use Doctrine\ORM\Cache\Persister\CachedPersister;
2829
use Doctrine\ORM\Event\LifecycleEventArgs;
2930
use Doctrine\ORM\Event\ListenersInvoker;
@@ -2750,6 +2751,13 @@ public function createEntity($className, array $data, &$hints = [])
27502751

27512752
// Properly initialize any unfetched associations, if partial objects are not allowed.
27522753
if (isset($hints[Query::HINT_FORCE_PARTIAL_LOAD])) {
2754+
Deprecation::trigger(
2755+
'doctrine/orm',
2756+
'https://github.com/doctrine/orm/issues/8471',
2757+
'Partial Objects are deprecated (here entity %s)',
2758+
$className
2759+
);
2760+
27532761
return $entity;
27542762
}
27552763

0 commit comments

Comments
 (0)