//generate validator
code+=classPropertyValidator(cls,k[i]);
//generic getter
- code+="public function get_"+k[i]+"(){return $this->prop_"+k[i]+";}\n";
+ code+="public function get"+k[i]+"(){return $this->prop_"+k[i]+";}\n";
//is it a list?
if(cls.propertyIsList(k[i])){
//lists...
QString code;
code+="public function clear_"+prop+"(){$this->prop_"+prop+"=array();}\n";
QString acode;//body of add_ function, see below
- code+="public function set_"+prop+"(array $values){\n";
+ code+="public function set"+prop+"(array $values){\n";
if(cls.propertyIsEnum(prop)){
QList<WocEnum>ev=cls.enumValues(cls.propertyPlainType(prop));
code+="\t$prop=array();\n";
QString WocPHPServerOut::classPropertyScalarSetters(const WocClass&cls,QString prop)
{
QString code;
- code+="public function set_"+prop+"($value){\n";
+ code+="public function set"+prop+"($value){\n";
if(cls.propertyIsEnum(prop)){
QList<WocEnum>ev=cls.enumValues(cls.propertyPlainType(prop));
code+="\tif(is_numeric($value)){\n\t\t$value=$value+0;\n";
}else{
if(cls.propertyIsObject(k[i])){
code+="\tforeach(WObject::elementsByTagName($elem,\""+k[i]+"\") as $el){\n";
- code+="\t\t$data->set_"+k[i]+"(WO"+cls.propertyPlainType(k[i])+"::fromXml($xml,$el));\n";
+ code+="\t\t$data->set"+k[i]+"(WO"+cls.propertyPlainType(k[i])+"::fromXml($xml,$el));\n";
code+="\t}\n";
}else
if(cls.propertyIsAttribute(k[i])){
code+="\tif($elem->hasAttribute(\""+k[i]+"\"))\n";
- code+="\t\t$data->set_"+k[i]+"($elem->getAttribute(\""+k[i]+"\"));\n";
+ code+="\t\t$data->set"+k[i]+"($elem->getAttribute(\""+k[i]+"\"));\n";
}else{
code+="\tforeach(WObject::elementsByTagName($elem,\""+k[i]+"\") as $el){\n";
if(cls.propertyIsBlob(k[i]))
- code+="\t\t$data->set_"+k[i]+"(base64_decode($el->textContent));\n";
+ code+="\t\t$data->set"+k[i]+"(base64_decode($el->textContent));\n";
else
- code+="\t\t$data->set_"+k[i]+"($el->textContent);\n";
+ code+="\t\t$data->set"+k[i]+"($el->textContent);\n";
code+="\t}\n";
}
}
if(cls.propertyIsList(prop)){
//is it a class?
if(cls.propertyIsObject(prop)){
- QString code="\tforeach($this->get_"+prop+"() as $o)\n\t\t";
+ QString code="\tforeach($this->get"+prop+"() as $o)\n\t\t";
code+="$root->appendChild($o->toXml($xml,\""+prop+"\"));\n";
return code;
}else{
}
}
//non lists:
- QString code="\t$p=$this->get_"+prop+"();\n\tif($p!==null)";
+ QString code="\t$p=$this->get"+prop+"();\n\tif($p!==null)";
//is it an attribute?
if(cls.propertyIsAttribute(prop))
return code+"\t$root->setAttribute(\""+prop+"\",$this->getstr_"+prop+"());\n";