Created
July 24, 2015 15:01
-
-
Save mjacobus/890e3166cc09a2fff2bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Bind values to the bound object | |
* | |
* @param array $values | |
* @return mixed | |
*/ | |
public function bindValues(array $values = array()) | |
{ | |
if (!is_object($this->object)) { | |
if ($this->baseFieldset === null || $this->baseFieldset->allowValueBinding() == false) { | |
// return; | |
} | |
} | |
if (!$this->hasValidated() && !empty($values)) { | |
$this->setData($values); | |
if (!$this->isValid()) { | |
return; | |
} | |
} elseif (!$this->isValid) { | |
return; | |
} | |
$filter = $this->getInputFilter(); | |
switch ($this->bindAs) { | |
case FormInterface::VALUES_RAW: | |
$data = $filter->getRawValues(); | |
break; | |
case FormInterface::VALUES_NORMALIZED: | |
default: | |
$data = $filter->getValues(); | |
break; | |
} | |
$data = $this->prepareBindData($data, $this->data); | |
// If there is a base fieldset, only hydrate beginning from the base fieldset | |
if ($this->baseFieldset !== null) { | |
$data = $data[$this->baseFieldset->getName()]; | |
$this->object = $this->baseFieldset->bindValues($data); | |
} else { | |
$this->object = parent::bindValues($data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment