Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added to form property closure support #11678

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
wants to merge 2 commits into from
Closed

Conversation

danidomi
Copy link

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #4067
License MIT
Doc PR no

Added to form property closure support

@danidomi danidomi changed the title Added to form proeperty closure support Added to form property closure support Aug 15, 2014
@@ -248,6 +256,9 @@ private function extractLabels($choices, array &$labels)
if (is_array($choice)) {
$labels[$i] = array();
$this->extractLabels($choice, $labels[$i]);
} elseif ($this->labelPath instanceof \Closure) {
$clousure = $this->labelPath;
$labels[$i] = $clousure($choice);
Copy link

Choose a reason for hiding this comment

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

s/clousure/closure/

@ghost
Copy link

ghost commented Aug 15, 2014

needs a test for it too.

@@ -88,7 +88,15 @@ class ObjectChoiceList extends ChoiceList
public function __construct($choices, $labelPath = null, array $preferredChoices = array(), $groupPath = null, $valuePath = null, PropertyAccessorInterface $propertyAccessor = null)
{
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
$this->labelPath = null !== $labelPath ? new PropertyPath($labelPath) : null;
if ($labelPath !== null) {
if ($labelPath instanceof \Closure) {
Copy link
Member

Choose a reason for hiding this comment

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

Why do you limit this to Closure instances? is_callable() seems more sensible to me.

@stof stof added the Form label Aug 18, 2014
@webmozart
Copy link
Contributor

ref #4067

@webmozart
Copy link
Contributor

Replaced by #12148.

@webmozart webmozart closed this Oct 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants