Skip to content

OneToManyPersister trigger deprecation. #12237

@laurentmuller

Description

@laurentmuller

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions