123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?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 SpGetDomains extends LuSpDbo {
-
- /**
- * @param $dam
- * @return \App\Http\DataAccess\SP\SpGetDomains|null
- */
- protected static function damToDbo($dam)
- {
- if (is_null($dam))
- return null;
- $dbo = new SpGetDomains();
-
- $dbo->setDomains(LuStringUtils::convertJsonString($dam->domains));
-
- return $dbo;
- }
-
-
- /**
- * @param $query string
- * @return \App\Http\DataAccess\SP\SpGetDomains[];
- */
- public static function execute($query)
- {
- $values = DB::select('SELECT to_json(data.domains) AS domains FROM sp_get_domains(:query) data', array(":query" => $query));
- $dboValues = array();
- foreach ($values as $value)
- $dboValues[] = self::damToDbo($value);
- return $dboValues;
- }
-
- /**
- * @param $query string
- * @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($query, $page, $perPage)
- {
- $values = DB::select('SELECT (SELECT count(*) FROM sp_get_domains(:query)) as count, (SELECT json_agg(q) FROM (SELECT * FROM sp_get_domains(:query) OFFSET (:page::int * :perPage::int) LIMIT :perPage) q) as data',
- array(":query" => $query, ":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(
- "Domains" => $this->_domains
- );
- }
-
- public static function jsonDeserialize($json)
- {
- $dbo = new SpGetDomains();
- if (isset($json["Domains"])) {
- $dbo->setDomains($json["Domains"]);
- }
- return $dbo;
- }
-
- public static function generateSample()
- {
- $dbo = new SpGetDomains();
- $dbo->setDomains("sample string");
- return $dbo;
- }
-
-
- /**
- * @var USER-DEFINED
- */
- protected $_domains;
- public function getDomains()
- {
- return $this->_domains;
- }
- public function setDomains($value)
- {
- $this->_domains = $value;
- }
- }
|