8000 [2.3][Propel1] re-factor Propel1 ModelChoiceList by havvg · Pull Request #9458 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[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

Closed

Conversation

havvg
Copy link
Contributor
@havvg havvg commented Nov 7, 2013
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;
Copy link
Member

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 ?

@stof
Copy link
Member
stof commented Nov 7, 2013

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignment of =

@havvg
Copy link
Contributor Author
havvg commented Nov 7, 2013

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

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.

@stof
Copy link
Member
stof commented Nov 7, 2013

@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

@bmeynell
Copy link
bmeynell commented Nov 7, 2013

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
@havvg havvg closed this Nov 8, 2013
fabpot added a commit that referenced this pull request Nov 14, 2013
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
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.

4 participants
0