Skip to content

Commit

Permalink
[GH-8471] undeprecate partials completly (#11647)
Browse files Browse the repository at this point in the history
* [GH-8471] Undeprecate all PARTIAL object usage.
  • Loading branch information
beberlei authored Oct 10, 2024
1 parent 14f2572 commit bea454e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
12 changes: 9 additions & 3 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ change in behavior.

Progress on this is tracked at https://github.com/doctrine/orm/issues/11624 .

## PARTIAL DQL syntax is undeprecated for non-object hydration
## PARTIAL DQL syntax is undeprecated

Use of the PARTIAL keyword is not deprecated anymore in DQL when used with a hydrator
that is not creating entities, such as the ArrayHydrator.
Use of the PARTIAL keyword is not deprecated anymore in DQL, because we will be
able to support PARTIAL objects with PHP 8.4 Lazy Objects and
Symfony/VarExporter in a better way. When we decided to remove this feature
these two abstractions did not exist yet.

WARNING: If you want to upgrade to 3.x and still use PARTIAL keyword in DQL
with array or object hydrators, then you have to directly migrate to ORM 3.3.x or higher.
PARTIAL keyword in DQL is not available in 3.0, 3.1 and 3.2 of ORM.

## Deprecate `\Doctrine\ORM\Query\Parser::setCustomOutputTreeWalker()`

Expand Down
8 changes: 0 additions & 8 deletions src/Query/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1850,14 +1850,6 @@ public function JoinAssociationDeclaration()
*/
public function PartialObjectExpression()
{
if ($this->query->getHydrationMode() === Query::HYDRATE_OBJECT) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/8471',
'PARTIAL syntax in DQL is deprecated for object hydration.'
);
}

$this->match(TokenType::T_PARTIAL);

$partialFieldSet = [];
Expand Down
10 changes: 0 additions & 10 deletions src/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
use Doctrine\ORM\Persisters\Entity\JoinedSubclassPersister;
use Doctrine\ORM\Persisters\Entity\SingleTablePersister;
use Doctrine\ORM\Proxy\InternalProxy;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Utility\IdentifierFlattener;
use Doctrine\Persistence\Mapping\RuntimeReflectionService;
use Doctrine\Persistence\NotifyPropertyChanged;
Expand Down Expand Up @@ -2920,15 +2919,6 @@ private function newInstance(ClassMetadata $class)
*/
public function createEntity($className, array $data, &$hints = [])
{
if (isset($hints[SqlWalker::HINT_PARTIAL])) {
Deprecation::trigger(
'doctrine/orm',
'https://github.com/doctrine/orm/issues/8471',
'Partial Objects are deprecated for object hydration (here entity %s)',
$className
);
}

$class = $this->em->getClassMetadata($className);

$id = $this->identifierFlattener->flattenIdentifier($class, $data);
Expand Down

0 comments on commit bea454e

Please sign in to comment.