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.

SpLuGetAllUserSettings.php 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * AUTO GENERATED BY LUTICATE GENERATOR
  4. * ANY CHANGES WILL BE OVERWRITTEN
  5. */
  6. namespace Luticate\Auth\DataAccess\SP;
  7. use Luticate\Utils\LuSpModel;
  8. use Luticate\Utils\LuMultipleDbo;
  9. use Luticate\Utils\LuStringUtils;
  10. use Illuminate\Support\Facades\DB;
  11. class SpLuGetAllUserSettings extends LuSpModel {
  12. protected static function damToDbo($dam)
  13. {
  14. if (is_null($dam))
  15. return null;
  16. $dbo = new SpLuGetAllUserSettings();
  17. $dbo->setSettings($dam->_settings);
  18. return $dbo;
  19. }
  20. public static function execute($_user_id)
  21. {
  22. $values = DB::select('SELECT * FROM sp_lu_get_all_user_settings(:_user_id)', array(":_user_id" => $_user_id));
  23. $dboValues = array();
  24. foreach ($values as $value)
  25. $dboValues[] = self::damToDbo($value);
  26. return $dboValues;
  27. }
  28. public static function getMultipleJson($_user_id, $page, $perPage)
  29. {
  30. $values = DB::select('SELECT (SELECT count(*) FROM sp_lu_get_all_user_settings(:_user_id)) as count, (SELECT json_agg(q) FROM (SELECT * FROM sp_lu_get_all_user_settings(:_user_id) OFFSET (:page::int * :perPage::int) LIMIT :perPage) q) as data',
  31. array(":_user_id" => $_user_id, ":page" => $page, ":perPage" => $perPage));
  32. $value = $values[0];
  33. if (is_null($value->data))
  34. {
  35. $value->data = '[]';
  36. }
  37. $data = LuStringUtils::convertJsonString($value->data);
  38. return new LuMultipleDbo($value->count, $data);
  39. }
  40. /**
  41. * @var json
  42. */
  43. protected $_Settings;
  44. public function getSettings()
  45. {
  46. return $this->_Settings;
  47. }
  48. public function setSettings($value)
  49. {
  50. $this->_Settings = $value;
  51. }
  52. }