You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sp.php.twig 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. {{ "<?php" }}
  2. /**
  3. * AUTO GENERATED BY LUTICATE GENERATOR
  4. * ANY CHANGES WILL BE OVERWRITTEN
  5. */
  6. namespace {{ namespace.as_it }};
  7. use Luticate\Utils\LuSpModel;
  8. use Illuminate\Support\Facades\DB;
  9. class {{ sp.sp_name.camel_upper }} extends LuSpModel {
  10. protected static function damToDbo($dam)
  11. {
  12. if (is_null($dam))
  13. return null;
  14. $dbo = new {{ sp.sp_name.camel_upper }}();
  15. {% for arg in args.out %}
  16. $dbo->set{{ arg.name.camel_upper }}($dam->{{ arg.name.as_it }});
  17. {% endfor %}
  18. return $dbo;
  19. }
  20. public static function execute({% for arg in args.in %}${{ arg.name.as_it }}{{ loop.last ? "" : ", " }}{% endfor %})
  21. {
  22. $values = DB::select('SELECT * FROM {{ sp.sp_name.as_it }}({% for arg in args.in %}?{{ loop.last ? "" : ", " }}{% endfor %})', array({% for arg in args.in %}${{ arg.name.as_it }}{{ loop.last ? "" : ", " }}{% endfor %}));
  23. {% if sp.proretset %}
  24. $dboValues = array();
  25. foreach ($values as $value)
  26. $dboValues[] = self::damToDbo($value);
  27. return $dboValues;
  28. {% else %}
  29. return self::damToDbo($values[0]);
  30. {% endif %}
  31. }
  32. {% for arg in args.out %}
  33. /**
  34. * @var {{ arg.data_type.php.as_it }}
  35. */
  36. protected $_{{ arg.name.camel_lower }};
  37. public function get{{ arg.name.camel_upper }}()
  38. {
  39. return $this->_{{ arg.name.camel_lower }};
  40. }
  41. public function set{{ arg.name.camel_upper }}($value)
  42. {
  43. $this->_{{ arg.name.camel_lower }} = $value;
  44. }
  45. {% endfor %}
  46. }