| 147 | | |
|---|
| 148 | | //return the result of our action |
|---|
| 149 | | return $actionInstance->$soapResultCallback(); |
|---|
| 150 | | } |
|---|
| 151 | | else |
|---|
| 152 | | { |
|---|
| 153 | | return; |
|---|
| 154 | | } |
|---|
| | 149 | |
|---|
| | 150 | //hook in the default result getter |
|---|
| | 151 | sfMixer::register('sfComponent', array($this, $soapResultCallback)); |
|---|
| | 152 | } |
|---|
| | 153 | if (sfConfig::get('sf_logging_enabled')) |
|---|
| | 154 | { |
|---|
| | 155 | sfContext::getInstance()->getLogger()->info(sprintf('{%s} Calling soapResultCallback \'%s\'.', __CLASS__, $soapResultCallback)); |
|---|
| | 156 | } |
|---|
| | 157 | |
|---|
| | 158 | //return the result of our action |
|---|
| | 159 | return $actionInstance->$soapResultCallback(); |
|---|
| | 167 | |
|---|
| | 168 | /** |
|---|
| | 169 | * Implements the default behavior to get the result of a soap action. |
|---|
| | 170 | * |
|---|
| | 171 | * @param sfAction $actionInstance The hooked sfAction instance |
|---|
| | 172 | * |
|---|
| | 173 | * @return mixed The result of the hooked sfAction instance |
|---|
| | 174 | */ |
|---|
| | 175 | public function defaultResultCallback($actionInstance) |
|---|
| | 176 | { |
|---|
| | 177 | $vars = $actionInstance->getVarHolder()->getAll(); |
|---|
| | 178 | |
|---|
| | 179 | //if we have one or more vars and shouldn't render |
|---|
| | 180 | if(count($vars) > 0 && $this->getRenderMode() == sfView::RENDER_NONE) |
|---|
| | 181 | { |
|---|
| | 182 | //get the default result array key |
|---|
| | 183 | $default_key = sfConfig::get('mod_'.$actionInstance->getModuleName().'_soap_return_key_'.$actionInstance->getActionName(), 'result'); |
|---|
| | 184 | |
|---|
| | 185 | //if there is only one var stored we return it |
|---|
| | 186 | if(count($vars) == 1) |
|---|
| | 187 | { |
|---|
| | 188 | reset($vars); |
|---|
| | 189 | return current($vars); |
|---|
| | 190 | } |
|---|
| | 191 | //if the default key exists we return the value |
|---|
| | 192 | else if(array_key_exists($default_key, $vars)) |
|---|
| | 193 | { |
|---|
| | 194 | return $vars[$default_key]; |
|---|
| | 195 | } |
|---|
| | 196 | } |
|---|
| | 197 | |
|---|
| | 198 | return; |
|---|
| | 199 | } |
|---|