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; } }