DDC-3316: [GH-1141] Always allow proxies on ToOne associations #4097

Closed
opened 2026-01-22 14:35:09 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Sep 22, 2014).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user @doctrinebot:

This issue is created automatically through a Github pull request on behalf of goetas:

Url: https://github.com/doctrine/doctrine2/pull/1141

Message:

Hi!
This patch combined with https://github.com/doctrine/common/pull/338 will allow to have proxies for long chains of ToOne associations:

User{
  private $id; // @id
  private $city;
  private $name;
}
City{
  private $id; // @id
  private $region; // @id
  private $name;
}
Region{
  private $id; // @id
  private $country; // @id
  private $name;
}
Country{
  private $id; // @id
  private $name;
}
$user = $repo->find(1);

// the current implementation must load the city, region
$user->getCity()->getRegion()->getCountry();
// the current implementation must load the city, region and the country
$user->getCity()->getRegion()->getCountry()->getName();

//with this patch
// here no queries will be executed
$user->getCity()->getRegion()->getCountry();
// here only will be loaded
$user->getCity()->getRegion()->getCountry()->getName();

Of course this patch will require some unit test, but can be acceptable as idea?

Originally created by @doctrinebot on GitHub (Sep 22, 2014). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user @doctrinebot: This issue is created automatically through a Github pull request on behalf of goetas: Url: https://github.com/doctrine/doctrine2/pull/1141 Message: Hi! This patch combined with https://github.com/doctrine/common/pull/338 will allow to have proxies for long chains of ToOne associations: ``` User{ private $id; // @id private $city; private $name; } City{ private $id; // @id private $region; // @id private $name; } Region{ private $id; // @id private $country; // @id private $name; } Country{ private $id; // @id private $name; } ``` ``` php $user = $repo->find(1); // the current implementation must load the city, region $user->getCity()->getRegion()->getCountry(); // the current implementation must load the city, region and the country $user->getCity()->getRegion()->getCountry()->getName(); //with this patch // here no queries will be executed $user->getCity()->getRegion()->getCountry(); // here only will be loaded $user->getCity()->getRegion()->getCountry()->getName(); ``` Of course this patch will require some unit test, but can be acceptable as idea?
admin added the Bug label 2026-01-22 14:35:09 +01:00
admin closed this issue 2026-01-22 14:35:09 +01:00
Author
Owner

@doctrinebot commented on GitHub (Sep 22, 2014):

@doctrinebot commented on GitHub (Sep 22, 2014): - duplicates [DDC-3258: [GH-1113] Added support for composite primary key on findBy methods and Criteria](http://www.doctrine-project.org/jira/browse/DDC-3258)
Author
Owner

@doctrinebot commented on GitHub (Jan 9, 2015):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-1141] was closed:
https://github.com/doctrine/doctrine2/pull/1141

@doctrinebot commented on GitHub (Jan 9, 2015): Comment created by @doctrinebot: A related Github Pull-Request [GH-1141] was closed: https://github.com/doctrine/doctrine2/pull/1141
Author
Owner

@doctrinebot commented on GitHub (Jan 9, 2015):

Issue was closed with resolution "Incomplete"

@doctrinebot commented on GitHub (Jan 9, 2015): Issue was closed with resolution "Incomplete"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4097