Beispiel #1
0
 /**
  * Serializes the survey to an associative array which
  * can then easily be converted into JSON or similar.
  * 
  * @since 0.1
  * 
  * @param null|array $fields
  * 
  * @return array
  */
 public function toArray($fields = null)
 {
     $data = parent::toArray($fields);
     $data['questions'] = array();
     foreach ($this->questions as $question) {
         $data['questions'][] = $question->toArray();
     }
     return $data;
 }