DumbTableModel.php 1011 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // Copyright 2019 Hackware SpA <human@hackware.cl>
  3. // "Hackware Web Services Core" is released under the MIT License terms.
  4. namespace Hawese\Tests;
  5. use Hawese\Core\TableModel;
  6. class DumbTableModel extends TableModel
  7. {
  8. public static $table = 'dumbs';
  9. public static $attributes = [
  10. 'id' => [],
  11. 'attr1' => ['nullable', 'string'], // used in testValidate()
  12. 'attr2' => [],
  13. 'custom_getter' => [],
  14. 'custom_setter' => [],
  15. 'created_at' => [],
  16. 'updated_at' => [],
  17. 'deleted_at' => [],
  18. 'else_at' => [],
  19. 'foreign_id' => [],
  20. 'other_foreign_id' => [],
  21. ];
  22. public static $foreign_keys = [
  23. 'foreign_id' => ForeignTableModel::class,
  24. 'other_foreign_id' => ForeignTableModel::class,
  25. ];
  26. protected function getCustomGetter()
  27. {
  28. return 'custom_getter_value';
  29. }
  30. protected function setCustomSetter($newValue)
  31. {
  32. $this->custom_setter = 'custom_setter_value';
  33. }
  34. }