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.

SensorsModel.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * AUTO GENERATED BY LUTICATE GENERATOR
  4. * ANY CHANGES WILL BE OVERWRITTEN
  5. * DO NOT DIRECTLY USE THIS FILE
  6. * USE Sensors.php
  7. * TO MAKE YOUR CHANGES AND DATABASE ACCESS
  8. */
  9. namespace App\Http\DataAccess\Models;
  10. use Luticate\Utils\LuModel;
  11. use App\Http\DBO\SensorsDbo;
  12. class SensorsModel extends LuModel
  13. {
  14. function __construct()
  15. {
  16. parent::__construct();
  17. $this->timestamps = false;
  18. }
  19. public function toDbo()
  20. {
  21. $dbo = new SensorsDbo();
  22. $dbo->setId($this->id);
  23. $dbo->setName($this->name);
  24. $dbo->setDescription($this->description);
  25. $dbo->setHostId($this->host_id);
  26. $dbo->setSensorTypeId($this->sensor_type_id);
  27. $dbo->setData($this->data);
  28. return $dbo;
  29. }
  30. /**
  31. * @param $dbo SensorsDbo
  32. * @param $model LuModel|null
  33. * @return Sensors
  34. */
  35. public function fromDbo($dbo, $model = null)
  36. {
  37. if (is_null($model))
  38. $model = new Sensors();
  39. $model->id = $dbo->getId();
  40. $model->name = $dbo->getName();
  41. $model->description = $dbo->getDescription();
  42. $model->host_id = $dbo->getHostId();
  43. $model->sensor_type_id = $dbo->getSensorTypeId();
  44. $model->data = $dbo->getData();
  45. return $model;
  46. }
  47. }