-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[WIP] [DoctrineBridge] Refactor EntityChoiceList #2728
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
Conversation
…ing an EntityLoader interface.
…x other inefficencies.
… were completly unnecessary (code was unreachable).
$this->unitOfWork = $em->getUnitOfWork(); | ||
$this->identifier = $em->getClassMetadata($class)->getIdentifierFieldNames(); | ||
$this->entityLoader = $entityLoader; | ||
$this->unitOfWork = $manager->getUnitOfWork(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not part of the interface. Nothing enforces have a UnitOfWork when implementing the interface
@beberlei can 8000 you rebase this PR and update it ? |
If you cannot, I can continue it. This refactoring is needed IMO |
|
||
public function __toString() | ||
{ | ||
return (string)$this->name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to the CS, you need to add a space here after the cast
What's the status of this PR? |
@fabpot I just sent a Pr to @beberlei to implement my suggestion: beberlei#1 As this PR needs to be rebased to fix conflicts, either @beberlei does it after merging the PR in his repo, either I rebase my branch and open a new PR to the symfony repo directly depending if he wants to do the work or if he prefers letting me doing it. |
completed and rebased in #2921 so closing this one |
Commits ------- 200ed54 [DoctrineBridge] Extracted the common type and made the choice list generic 3c81b62 [Doctrine] Cleanup and move loader into its own method 7646a5b [Doctrine] Dont allow null in ORMQueryBuilderLoader 988c2a5 Adjust check 3b5c617 [DoctrineBridge] Remove large parts of the EntityChoiceList code that were completly unnecessary (code was unreachable). b919d92 [DoctrineBridge] Optimize fetching of entities to use WHERE IN and fix other inefficencies. 517eebc [DoctrineBridge] Refactor entity choice list to be ORM independant using an EntityLoader interface. Discussion ---------- [DoctrineBridge] Refactor EntityChoiceList Bug fix: no Feature addition: yes Backwards compatibility break: no (99%) Symfony2 tests pass: yes This decouples the ORM from the EntityChoiceList and makes its much more flexible. Instead of having a "query_builder" to do smart or complex queries you can now create "loader" instances which can arbitrarily help loading entities. Additionally i removed lots of code that was unnecessary and not used by the current code. There is a slight BC break in that the EntityChoiceList class is now accepting an EntityLoaderInterface instead of a querybuilder. However that class was nested inside the EntityType and should not be widely used or overwritten. The abstract class DoctrineType is meant to be used as base class by other Doctrine project to share the logic by simply using a different type name and a different loader implementation. This PR replaces #2728. --------------------------------------------------------------------------- by beberlei at 2011/12/19 09:20:43 -0800 Thanks for doing the last refactorings, this is now fine from my side as well.
Bug fix: no
Feature addition: yes
Backwards compatibility break: no (99%)
Symfony2 tests pass: yes
This decouples the ORM from the EntityChoiceList and makes its much more flexible. Instead of having a "query_builder" to do smart or complex queries you can now create "loader" instances which can arbitrarily help loading entities.
Additionally i removed lots of code that was unnecessary and not used by the current code.
There is a slight BC break in that the EntityChoiceList class is now accepting an EntityLoaderInterface instead of a querybuilder. However that class was nested inside the EntityType and should not be widely used or overwritten.