Example #1
0
 /**
  * @overrides get() from RestResource
  */
 public function get()
 {
     if (parent::get() !== false) {
         $res = new Default_Model_Categories();
         if (is_numeric($this->getParam("id"))) {
             $res->filter->id->numequals($this->getParam("id"));
         } elseif (substr($this->getParam("id"), 0, 2) === "s:") {
             $res->filter->name->ilike(substr($this->getParam("id"), 2));
         } else {
             return false;
         }
         $res->refresh("xml", true);
         return new XMLFragmentRestResponse($res->items, $this);
     } else {
         return false;
     }
 }