ResolveTargetEntities causes Warning: Undefined array Key *Resolved Entity Name* #6762

Open
opened 2026-01-22 15:38:09 +01:00 by admin · 0 comments
Owner

Originally created by @rothzeta on GitHub (Jun 17, 2021).

Hello,

Using doctrine 2.9.3

When using an interface as the join column class and then using a different class in a native query then the one declared in ResolveTargetEntities, I get a warning in getResult()

Before upgrading to 2.9 I didn't have this problem in fact I wasn't using ResolveTargetEntities at all and just used native queries
with no errors but since 2.9 I had to add the ResolveTargetEntities when using $rsm->addRootEntityFromClassMetadata because it now checks whether the entity in the manyToOne association exist and was throwing an error.

exemple:

doctrine.yaml

resolve_target_entities :

      'App\Entity\ABInterface' : 'App\Entity\ClassA'

Repository


$rsm->addRootEntityFromClassMetadata(Activite::class, 'a');

$rsm->addJoinedEntityFromClassMetadata('App\Entity\ClassB', 'b', 'a', 'user')

Entity

	#[ManyToOne(ABInterface::class)]
	#[Valid]
	private ABInterface $user;

image

Originally created by @rothzeta on GitHub (Jun 17, 2021). Hello, Using doctrine 2.9.3 When using an interface as the join column class and then using a different class in a native query then the one declared in ResolveTargetEntities, I get a warning in getResult() Before upgrading to 2.9 I didn't have this problem in fact I wasn't using ResolveTargetEntities at all and just used native queries with no errors but since 2.9 I had to add the ResolveTargetEntities when using $rsm->addRootEntityFromClassMetadata because it now checks whether the entity in the manyToOne association exist and was throwing an error. exemple: doctrine.yaml ``` resolve_target_entities : 'App\Entity\ABInterface' : 'App\Entity\ClassA' ``` Repository ``` $rsm->addRootEntityFromClassMetadata(Activite::class, 'a'); $rsm->addJoinedEntityFromClassMetadata('App\Entity\ClassB', 'b', 'a', 'user') ``` Entity ``` #[ManyToOne(ABInterface::class)] #[Valid] private ABInterface $user; ``` ![image](https://user-images.githubusercontent.com/17890734/122382900-a2d0ad80-cf6a-11eb-9ee1-4ca83fd18d3e.png)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6762