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.

model.php.twig 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {{ "<?php" }}
  2. /**
  3. * AUTO GENERATED BY LUTICATE GENERATOR
  4. * ANY CHANGES WILL BE OVERWRITTEN
  5. */
  6. namespace App\Http\DataAccess\Models;
  7. use Luticate\Utils\LuModel;
  8. use App\Http\DBO\{{ dbo_name.camel_upper }};
  9. class {{ model_name.camel_upper }} extends LuModel
  10. {
  11. function __construct()
  12. {
  13. parent::__construct();
  14. $this->timestamps = false;
  15. }
  16. public function toDbo()
  17. {
  18. $dbo = new {{ dbo_name.camel_upper }}();
  19. {% for column in columns %}
  20. $dbo->set{{ column.name.camel_upper }}($this->{{ column.name.as_it }});
  21. {% endfor %}
  22. return $dbo;
  23. }
  24. /**
  25. * @param $dbo \App\Http\DBO\{{ dbo_name.camel_upper }}
  26. * @param $dam LuModel|null
  27. * @return {{ model_name.camel_upper }}
  28. */
  29. public function fromDbo($dbo, $dam = null)
  30. {
  31. if (is_null($dam))
  32. $dam = new {{ model_name.camel_upper }}();
  33. {% for column in columns %}
  34. $dam->{{ column.name.as_it }} = $dbo->get{{ column.name.camel_upper }}();
  35. {% endfor %}
  36. return $dam;
  37. }
  38. }