123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <?php
-
- /**
- * AUTO GENERATED BY LUTICATE GENERATOR
- * ANY CHANGES WILL BE OVERWRITTEN
- */
-
- namespace App\Http\DataAccess\SP;
-
- use Luticate\Utils\LuSpDbo;
- use Luticate\Utils\LuMultipleDbo;
- use Luticate\Utils\LuStringUtils;
- use Illuminate\Support\Facades\DB;
-
- class SpGetImages extends LuSpDbo {
-
- /**
- * @param $dam
- * @return \App\Http\DataAccess\SP\SpGetImages|null
- */
- protected static function damToDbo($dam)
- {
- if (is_null($dam))
- return null;
- $dbo = new SpGetImages();
-
- $dbo->setId(LuStringUtils::convertJsonString($dam->id));
- $dbo->setName(LuStringUtils::convertJsonString($dam->name));
- $dbo->setUserId(LuStringUtils::convertJsonString($dam->user_id));
- $dbo->setDate(LuStringUtils::convertJsonString($dam->date));
-
- return $dbo;
- }
-
-
- /**
- * @param $_only_mine boolean
- * @param $_user_id_me integer
- * @return \App\Http\DataAccess\SP\SpGetImages[];
- */
- public static function execute($_only_mine, $_user_id_me)
- {
- $values = DB::select('SELECT to_json(data.id) AS id, to_json(data.name) AS name, to_json(data.user_id) AS user_id, to_json(data.date) AS date FROM sp_get_images(:_only_mine, :_user_id_me) data', array(":_only_mine" => $_only_mine, ":_user_id_me" => $_user_id_me));
- $dboValues = array();
- foreach ($values as $value)
- $dboValues[] = self::damToDbo($value);
- return $dboValues;
- }
-
- /**
- * @param $_only_mine boolean
- * @param $_user_id_me integer
- * @param $page int The page number, 0 based
- * @param $perPage int The number of items per page
- * @return \Luticate\Utils\LuMultipleDbo;
- */
- public static function getMultipleJson($_only_mine, $_user_id_me, $page, $perPage)
- {
- $values = DB::select('SELECT (SELECT count(*) FROM sp_get_images(:_only_mine, :_user_id_me)) as count, (SELECT json_agg(q) FROM (SELECT * FROM sp_get_images(:_only_mine, :_user_id_me) OFFSET (:page::int * :perPage::int) LIMIT :perPage) q) as data',
- array(":_only_mine" => $_only_mine, ":_user_id_me" => $_user_id_me, ":page" => $page, ":perPage" => $perPage));
- $value = $values[0];
- if (is_null($value->data))
- {
- $value->data = '[]';
- }
- $data = LuStringUtils::convertJsonString($value->data);
- return new LuMultipleDbo($value->count, $data);
- }
-
- public function jsonSerialize()
- {
- return array(
- "Id" => $this->_id,
- "Name" => $this->_name,
- "UserId" => $this->_userId,
- "Date" => $this->_date
- );
- }
-
- public static function jsonDeserialize($json)
- {
- $dbo = new SpGetImages();
- if (isset($json["Id"])) {
- $dbo->setId($json["Id"]);
- }
- if (isset($json["Name"])) {
- $dbo->setName($json["Name"]);
- }
- if (isset($json["UserId"])) {
- $dbo->setUserId($json["UserId"]);
- }
- if (isset($json["Date"])) {
- $dbo->setDate($json["Date"]);
- }
- return $dbo;
- }
-
- public static function generateSample()
- {
- $dbo = new SpGetImages();
- $dbo->setId(42);
- $dbo->setName("sample string");
- $dbo->setUserId(42);
- $dbo->setDate("sample string");
- return $dbo;
- }
-
-
- /**
- * @var integer
- */
- protected $_id;
- public function getId()
- {
- return $this->_id;
- }
- public function setId($value)
- {
- $this->_id = $value;
- }
-
- /**
- * @var text
- */
- protected $_name;
- public function getName()
- {
- return $this->_name;
- }
- public function setName($value)
- {
- $this->_name = $value;
- }
-
- /**
- * @var integer
- */
- protected $_userId;
- public function getUserId()
- {
- return $this->_userId;
- }
- public function setUserId($value)
- {
- $this->_userId = $value;
- }
-
- /**
- * @var timestamp without time zone
- */
- protected $_date;
- public function getDate()
- {
- return $this->_date;
- }
- public function setDate($value)
- {
- $this->_date = $value;
- }
- }
|