-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[2.3][Propel1] re-factor Propel1 ModelChoiceList #9458
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
Q | A |
---|---|
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | fixes propelorm/Propel#789 |
License | MIT |
@@ -55,14 +55,14 @@ class ModelChoiceList extends ObjectChoiceList | |||
* | |||
* @var Boolean | |||
*/ | |||
protected $loaded = false; | |||
protected $isLoaded = false; |
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.
why are you renaming it ?
please add a testcase reproducing the bugfix to avoid regressions. and it looks like you are now loading all choices all the time, right ? The choice list was avoiding it on submission when you only need the submitted choice, not all available choices |
$this->query = $queryObject ?: $query; | ||
$this->loaded = is_array($choices) || $choices instanceof \Traversable; | ||
$this->identifier = $this->query->getTableMap()->getPrimaryKeys(); | ||
$this->isLoaded = is_array($choices) || $choices instanceof \Traversable; |
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.
alignment of =
That's on purpose, as it was possible to submit a choice value, which was not part of the choice list (the same model, but the list created with a filter). I can't think of a scenario, where you actually don't load the list values, when using the choice list. |
@havvg The ChoiceList should create the query by preserving the existing filter and adding an extra condition when loading only the needed values, like done for the Doctrine implementation |
Will this end up in Symfony 2.3 only or 2.2 as well? |
* add BaseModelChoiceListTest ensuring compatibility * fix keys and order are preserved * fix lazy-load to use filters of initial query
This PR was merged into the 2.2 branch. Discussion ---------- [2.2][Propel1] re-factor Propel1 ModelChoiceList | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | fixes propelorm/Propel#789 | License | MIT replaces #9458 Commits ------- 613b5f6 re-factor Propel1 ModelChoiceList