OneToManyPersister trigger deprecation. #7563

Closed
opened 2026-01-22 15:53:30 +01:00 by admin · 1 comment
Owner

Originally created by @laurentmuller on GitHub (Oct 26, 2025).

Bug Report

With commit doctrine/collections#472, the OneToManyPersister class trigger deprecations.

Q A
Version 3.5.2

Summary

The OneToManyPersister class use Criteria class without setting the $accessRawFieldValues parameter value to true.

Current behavior

In the count() function, a Criteria class is created without the $accessRawFieldValues parameter:

public function count(PersistentCollection $collection): int
{
    //...
    $criteria = new Criteria(Criteria::expr()->eq($mapping->mappedBy, $collection->getOwner()));
    //...
}

This is the same for the containsKey() and contains() functions.

Expected behavior

No deprecation must be raised.

public function count(PersistentCollection $collection): int
{
    //...
    $criteria = new Criteria(
        expression: Criteria::expr()->eq($mapping->mappedBy, $collection->getOwner()),
        accessRawFieldValues: true
     );
    //...
}

Or use:

Criteria::create(true);

How to reproduce

Just use a collection in an entity and call count() function.

Originally created by @laurentmuller on GitHub (Oct 26, 2025). ### Bug Report With commit doctrine/collections#472, the `OneToManyPersister` class trigger deprecations. | Q | A |-------------------------------------------- | ------ | Version | 3.5.2 #### Summary The `OneToManyPersister` class use `Criteria` class without setting the `$accessRawFieldValues` parameter value to `true`. #### Current behavior In the `count()` function, a `Criteria` class is created without the `$accessRawFieldValues` parameter: ```php public function count(PersistentCollection $collection): int { //... $criteria = new Criteria(Criteria::expr()->eq($mapping->mappedBy, $collection->getOwner())); //... } ``` This is the same for the `containsKey()` and `contains()` functions. #### Expected behavior No deprecation must be raised. ```php public function count(PersistentCollection $collection): int { //... $criteria = new Criteria( expression: Criteria::expr()->eq($mapping->mappedBy, $collection->getOwner()), accessRawFieldValues: true ); //... } ``` Or use: ```php Criteria::create(true); ``` #### How to reproduce Just use a collection in an entity and call `count()` function.
admin closed this issue 2026-01-22 15:53:30 +01:00
Author
Owner

@W0rma commented on GitHub (Nov 12, 2025):

@laurentmuller Can you confirm that the deprecation is gone in version 2.20.7 and/or 3.5.3?

@W0rma commented on GitHub (Nov 12, 2025): @laurentmuller Can you confirm that the deprecation is gone in version `2.20.7` and/or `3.5.3`?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7563