- //create a service action
- $actionName = $action->attributes()->name;
-
- $paramNames = array('callback');
- foreach($action->children() as $actionParam)
- if($actionParam->getName() == 'param')
- $paramNames[] = $actionParam->attributes()->name;
- $paramNames = join(', ', $paramNames);
-
- // action method signature
- if(in_array($actionName, array('list', 'clone', 'delete', 'export'))) // because list & clone are preserved in PHP
- $actionSignature = "$serviceClassName.prototype." . $actionName . "Action = function($paramNames)";
- else
- $actionSignature = "$serviceClassName.prototype." . $actionName . " = function($paramNames)";
-
- $actionClass .= $actionSignature . "{\n";
-
- //validate parameter default values
- foreach($action->children() as $actionParam)
- {
- if($actionParam->getName() != 'param')