예제 #1
0
파일: Form.php 프로젝트: Flesh192/magento
 /**
  * {@inheritDoc}
  *
  * @param bool $onlyBase
  */
 public function populateValues($data, $onlyBase = false)
 {
     if ($onlyBase && $this->baseFieldset !== null) {
         $name = $this->baseFieldset->getName();
         if (array_key_exists($name, $data)) {
             $this->baseFieldset->populateValues($data[$name]);
         }
     } else {
         parent::populateValues($data);
     }
 }
예제 #2
0
 /**
  * Recursively extract values for elements and sub-fieldsets, and populate form values
  *
  * @return array
  */
 protected function extract()
 {
     if (null !== $this->baseFieldset) {
         $name = $this->baseFieldset->getName();
         $values[$name] = $this->baseFieldset->extract();
         $this->baseFieldset->populateValues($values[$name]);
     } else {
         $values = parent::extract();
         $this->populateValues($values);
     }
     return $values;
 }
예제 #3
0
파일: Form.php 프로젝트: navassouza/zf2
 /**
  * Extract values from the bound object and populate
  * the form elements
  * 
  * @return void
  */
 protected function extract()
 {
     if (!is_object($this->object)) {
         return;
     }
     $hydrator = $this->getHydrator();
     if (!$hydrator instanceof Hydrator\HydratorInterface) {
         return;
     }
     $values = $hydrator->extract($this->object);
     if (!is_array($values)) {
         // Do nothing if the hydrator returned a non-array
         return;
     }
     if (null !== $this->baseFieldset) {
         $this->baseFieldset->populateValues($values);
     } else {
         $this->populateValues($values);
     }
 }