set.tpl 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. {assign var="datetime" value=$file->GetFileCreateTime()}
  2. {assign var="namespace" value=$file->GetNamespace()}
  3. {assign var="classes" value=$file->GetClasses()}
  4. {assign var="uses" value=$file->GetUses()}
  5. <?php
  6. /**
  7. * Created by FFB.
  8. * Company: Shenzhen Zhixun Information Tec. Nanchang Com.
  9. * Copyright: ShenzhenZhixun
  10. * Email: eastbus@126.com
  11. * User: FFB
  12. * Date: {$datetime}
  13. * 文件不允许修改,自动生成
  14. */
  15. namespace {$namespace};
  16. {section name=index loop=$uses}
  17. use {{$uses[index]}};
  18. {/section}
  19. {section name=index loop=$classes}
  20. {assign var="className" value=$classes[index]->GetClassName()}
  21. {assign var="tableName" value=$classes[index]->GetTable()->GetName()}
  22. {assign var="attrs" value=$classes[index]->GetAttrs()}
  23. {assign var="extends" value=$classes[index]->GetExtends()}
  24. class {$className}{foreach item=e from=$extends key=i}{if $i == 0} extends {/if}{$e}{/foreach}{
  25. public static function tableName()
  26. {
  27. return '{literal}{{{/literal}{{$tableName}}{literal}}}{/literal}';
  28. }
  29. {section name=index loop=$attrs}
  30. {assign var="fieldName" value=$attrs[index]->GetColumn()->GetName()}
  31. {assign var="fieldComment" value=$attrs[index]->GetColumn()->GetComment()}
  32. {assign var="attrName" value=$attrs[index]->GetName()}
  33. /**
  34. * ------------ 字段 {{$fieldName}}
  35. * ------------ 表字段注释: {{$fieldComment}}
  36. */
  37. public function set{{$attrName}}($val): self
  38. {
  39. $this->setAttr("{{$fieldName}}", $val);
  40. return $this;
  41. }
  42. // ---------------------------------------------
  43. {/section}
  44. }
  45. {/section}