示例#1
0
 /**
  * @overrides get() from RestResource
  */
 public function get()
 {
     if (parent::get() !== false) {
         $res = new Default_Model_Sites();
         if (substr($this->getParam("id"), 0, 2) === "s:") {
             $res->filter->name->ilike(substr($this->getParam("id"), 2));
         } elseif (substr($this->getParam("id"), 0, 2) === "g:") {
             $res->filter->guid->equals(substr($this->getParam("id"), 2));
         } elseif (is_string($this->getParam("id")) && trim($this->getParam("id")) !== "") {
             $res->filter->id->equals($this->getParam("id"));
         } else {
             return false;
         }
         $res->refresh("xml", true);
         return new XMLFragmentRestResponse($res->items, $this);
     } else {
         return false;
     }
 }
 public function getSite()
 {
     if ($this->_site === null) {
         $Sites = new Default_Model_Sites();
         $Sites->filter->id->equals($this->getSiteID());
         if ($Sites->count() > 0) {
             $this->_site = $Sites->items[0];
         }
     }
     return $this->_site;
 }