//setters
sl=trn.outputNames();
for(int i=0;i<sl.size();i++){
+ code+="public function result"+sl[i]+"(){return $this->aoutput[\""+sl[i]+"\"];}\n";
QString add;
QString t=trn.outputType(sl[i]);
code+="public function set"+sl[i]+"($v){\n";
QString WocPHPServerOut::trnExecute(const WocTransaction&trn)
{
+ //the execute function is split into a static and non-static part,
+ //since the code from the wolf file assumes to be inside the instance
QStringList in=trn.inputNames();
+ //static wrapper for execution
QString code="static public function execute(";
for(int i=0;i<in.size();i++){
if(i)code+=",";
code+="$"+in[i];
}
code+=")\n{\n\t$inst=new "+trnClassName(trn)+";\n";
+ code+="\t$inst->do_execute(";
+ for(int i=0;i<in.size();i++){
+ if(i)code+=",";
+ code+="$"+in[i];
+ }
+ code+=");\n";
+ code+="\treturn $inst;\n}\n";
+ //actual non-static implementation
+ code+="private function do_execute(";
+ for(int i=0;i<in.size();i++){
+ if(i)code+=",";
+ code+="$"+in[i];
+ }
+ code+=")\n{\n";
for(int i=0;i<in.size();i++)
code+="\t$this->ainput[\""+in[i]+"\"]=$"+in[i]+";\n";
code+="\tself::$running=\""+trn.name()+"\";\n";
- code+="\t$inst->do_execute();\n";
- code+="\tself::$running=\"\";\n";
- code+="\treturn $inst;\n}\n";
- code+="private function do_execute(){"+trn.callFunction("php")+"}\n";
+ code+="\ttry{"+trn.callFunction("php")+"}\n\tcatch(Exception $ex){\n";
+ code+="\t\tself::$running=\"\";\n\t\t$this->handleException($ex);\n\t}\n";
+ code+="\tself::$running=\"\";\n}\n";
return code;
}