Skip to content

[Bridge\Doctrine] Add "DoctrineType::reset()" method #24232

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

Merged
merged 1 commit into from
Sep 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,9 @@ public function getParent()
{
return 'Symfony\Component\Form\Extension\Core\Type\ChoiceType';
}

public function reset()
{
$this->choiceLoaders = array();
Copy link
Member

Choose a reason for hiding this comment

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

You're throwing away all choice loaders. Wouldn't it be enough to iterate over all choice loaders and reset the $choiceList property of each of them?

Copy link
Member Author

@nicolas-grekas nicolas-grekas Sep 18, 2017

Choose a reason for hiding this comment

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

Looking at the code, I think it's fine this way: clearing DoctrineChoiceLoader::$choiceList would require more CPU here, but wouldn't save much on new iterations.

}
}