/** * Method to recursively bind data to a parent object. * * @param array $parent The parent object on which to attach the data values. * @param mixed $data An array or object of data to bind to the parent object. * @param boolean $raw Set to false to convert all object to array. * * @return void */ protected function bindData(&$parent, $data, $raw = false) { // Ensure the input data is an array. if (!$raw) { $data = RegistryHelper::toArray($data, true); } foreach ($data as $key => $value) { if ($value === null) { continue; } if (is_array($value)) { if (!isset($parent[$key])) { $parent[$key] = array(); } $this->bindData($parent[$key], $value); } else { $parent[$key] = $value; } } }