public function toArray()
{
if (!$this->hasParam('field') && !$this->hasParam('script')) {
throw new InvalidException('Either the field param or the script param should be set');
}
$array = parent::toArray();
$baseName = $this->_getBaseName();
if (isset($array[$baseName]['script']) && is_array($array[$baseName]['script'])) {
$script = $array[$baseName]['script'];
unset($array[$baseName]['script']);
$array[$baseName] = array_merge($array[$baseName], $script);
}
return $array;
}