コード例 #1
0
ファイル: form.php プロジェクト: vanie3/appland
 protected function bindLevel($group, $data)
 {
     // Ensure the input data is an array.
     settype($data, 'array');
     // Process the input data.
     foreach ($data as $k => $v) {
         if ($this->findField($k, $group)) {
             // If the field exists set the value.
             $this->data->set($group . '.' . $k, $v);
         } elseif (is_object($v) || MArrayHelper::isAssociative($v)) {
             // If the value is an object or an associative array, hand it off to the recursive bind level method
             $this->bindLevel($group . '.' . $k, $v);
         }
     }
 }
コード例 #2
0
ファイル: registry.php プロジェクト: vanie3/appland
 protected function bindData(&$parent, $data)
 {
     // Ensure the input data is an array.
     if (is_object($data)) {
         $data = get_object_vars($data);
     } else {
         $data = (array) $data;
     }
     foreach ($data as $k => $v) {
         if (is_array($v) && MArrayHelper::isAssociative($v) || is_object($v)) {
             $parent->{$k} = new stdClass();
             $this->bindData($parent->{$k}, $v);
         } else {
             $parent->{$k} = $v;
         }
     }
 }