public function toArray() { $array = parent::toArray(); if ($this->subConditions) { foreach ($this->subConditions as $sub) { $array['sub'][] = $sub->toArray(); } } if ($this->records) { foreach ($this->records as $record) { $array['records'][] = $record->toArray(); } } return $array; }