Skip to content

Commit

Permalink
Workaround for zendframework#6263, which is related to zendframework#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Talbot authored and adamlundrigan committed Nov 15, 2014
1 parent 6506e2d commit 9553be7
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions library/Zend/Form/Element/Collection.php
Expand Up @@ -509,23 +509,25 @@ public function extract()
}

$values = array();

foreach ($this->object as $key => $value) {
if ($this->hydrator) {
if (!$this->targetElement instanceof FieldsetInterface) {
$values[$key] = $value;
if (!$this->createNewObjects() && $this->has($key)) {
$this->get($key)->setValue($value);
}
} elseif ($this->hydrator) {
$values[$key] = $this->hydrator->extract($value);
} elseif ($value instanceof $this->targetElement->object) {
// @see https://github.com/zendframework/zf2/pull/2848
} elseif ($this->targetElement->allowObjectBinding($value)) {
$targetElement = clone $this->targetElement;
$targetElement->object = $value;
$targetElement->setObject($value);
$values[$key] = $targetElement->extract();
if (!$this->createNewObjects() && $this->has($key)) {
$fieldset = $this->get($key);
if ($fieldset instanceof Fieldset && $fieldset->allowObjectBinding($value)) {
$fieldset->setObject($value);
}
$this->get($key)->setObject($value);
}
}
}

return $values;
}

Expand Down

0 comments on commit 9553be7

Please sign in to comment.