Ejemplo n.º 1
0
 /**
  * Responds with information about updated inserted option
  *
  * @method put
  * @return json/xml data
  */
 public function put($id)
 {
     $results = array();
     $option = Options::findFirst($id);
     if ($option) {
         $optionCollection = OptionsCollection::findFirst(array(array('id' => $id)));
         $optionCollection->id = $option->id;
         $optionCollection->type = $option->type;
         $optionCollection->name = $option->name;
         $optionCollection->value = $option->value;
         $optionCollection->label = $option->label;
         $optionCollection->status = $option->status;
         $optionCollection->created = $option->created;
         $optionCollection->modified = $option->modified;
         $results['id'] = $option->id;
     }
     return $results;
 }
Ejemplo n.º 2
0
 /**
  * Responds with information about an option
  *
  * @method searchOne
  * @return json/xml data
  */
 public function searchOne($id)
 {
     $results = array();
     $request = $this->di->get('requestBody');
     $parameters = $request->get();
     if (count($parameters) > 1) {
         $option = new OptionsCollection($this->di);
         $results = $this->respond($option, $id);
     } else {
         $results = OptionsCollection::findFirstById($id);
     }
     if (!$results) {
         throw new HTTPException("Not found", 404, array('dev' => 'Option does not exist', 'internalCode' => 'P1000', 'more' => ''));
     }
     return $results;
 }