Skip to content

Identity map, another object of class was already present for the same ID #2176

Description

@danilovl

Bug Report

Q A
Version ^3.1
Previous Version if the bug is a regression ^2.8

Another doctrine packages:

"doctrine/doctrine-bundle": "^3.1",
"doctrine/doctrine-migrations-bundle": "^4.0",
"doctrine/orm": "^3.3",
"symfony": "7.4"
"php": "8.5.0"

Before update to 3.1 - works fine

Summary

Image
Wallet

   #[ORM\ManyToOne(targetEntity: Currency::class, inversedBy: 'wallets')]
   #[ORM\JoinColumn(name: 'currency_id', referencedColumnName: 'id', nullable: false)]
   private Currency $currency;
Currency

    /**
     * @var Collection<Wallet>
     */
    #[ORM\OneToMany(targetEntity: Wallet::class, mappedBy: 'currency')]
    private Collection $wallets;

Uses simple query to get all entities.

$this->createQueryBuilder('wallet');

Current behavior

When the cache does not exist, opening the page causes this error only for these relations in twig.
When use dump in controller - no error.

After the cache is created, everything works fine.

Expected behavior

no error

How to reproduce

not sure how reproduce and why this error show only for one entity relationship.

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