Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always allow proxies on ToOne associations #1141

Closed
wants to merge 1 commit into from

Conversation

goetas
Copy link
Member

@goetas goetas commented Sep 22, 2014

Hi!
This patch combined with doctrine/common#338 will allow to have proxies for long chains of ToOne associations:

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

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

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

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

@doctrinebot
Copy link

Hello,

thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

http://www.doctrine-project.org/jira/browse/DDC-3316

We use Jira to track the state of pull requests and the versions they got
included in.

@goetas
Copy link
Member Author

goetas commented Sep 23, 2014

@Ocramius I'm trying to explore a different approach, but this PR is "related"/"overlaps" to #1113 (always talking about foreign identifier entities...).

What is your opinion about #1113 ... is it acceptable?

@goetas
Copy link
Member Author

goetas commented Jan 9, 2015

At the moment I do not have time to work on it... if #1241 will be merged, the problem will be solved in better way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants