Пример #1
0
 /**
  * Bind values to the bound object
  *
  * @param array $values
  * @return mixed
  */
 public function bindValues(array $values = array())
 {
     if (!is_object($this->object)) {
         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);
     }
 }
Пример #2
0
 /**
  * Bind values to the bound object
  *
  * @param array $values
  * @return mixed
  */
 public function bindValues(array $values = array())
 {
     if (!is_object($this->object)) {
         return;
     }
     if (!$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);
     $this->object = parent::bindValues($data);
 }