Пример #1
0
 /**
  * Loads an associative array of data into the form from the relevant request variable.
  * This method also adds in NULL values for empty checkbox and radio button fields.
  */
 function loadRequest()
 {
     $data = SimpleForm_FormArrayHelper::collapse($this->getRequestParams());
     // add NULL values for missing elements
     foreach (array_keys($this->getValues()) as $name) {
         if (!isset($data[$name])) {
             $data[$name] = NULL;
         }
     }
     return $this->load($data);
 }
 function testCollapseWithNumericKeys()
 {
     $from = array('prize' => array(5 => '120', 22 => '120'));
     $this->assertEqual(SimpleForm_FormArrayHelper::collapse($from), array('prize[5]' => '120', 'prize[22]' => '120'));
 }