Skip to content

Commit fb4cc71

Browse files
committed
[AbstractEntityTransformer] property accepts now closure
1 parent 559127b commit fb4cc71

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Form/DataTransformer/Entity/AbstractEntityTransformer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ function ($child) {
8686
protected function extractLabel($object)
8787
{
8888
if ($this->property) {
89-
return $this->accessor->getValue($object, $this->property);
89+
if ($this->property instanceof \Closure) {
90+
return $this->property->__invoke($object);
91+
} else {
92+
return $this->accessor->getValue($object, $this->property);
93+
}
9094
} elseif (method_exists($object, '__toString')) {
9195
return (string)$object;
9296
} else {

0 commit comments

Comments
 (0)