location_update_log_entry.php 815 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * @property int $id
  4. * @property int $location_id
  5. * @property int $user_id
  6. * @property string $modifications_json
  7. * @property string $dts
  8. */
  9. class LocationUpdateLogEntry extends Model {
  10. protected static $table = "location_update_log_entry";
  11. protected static $id_field = "id";
  12. protected static $fillable_fields = ["location_id", "user_id", "modifications_json", "dts"];
  13. // Object methods
  14. /**
  15. * @return Location
  16. * @throws Exception
  17. */
  18. public function getLocation(): ?Location {
  19. return Location::get($this->location_id);
  20. }
  21. /**
  22. * @return User
  23. * @throws Exception
  24. */
  25. public function getUser(): ?User {
  26. return User::get($this->user_id);
  27. }
  28. /**
  29. * @return array
  30. */
  31. public function getModifications(): array {
  32. return json_decode($this->modifications_json) ?: [];
  33. }
  34. }