/**
  * 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;
 }
 /**
  * Responds with information about updated inserted option
  *
  * @method put
  * @return json/xml data
  */
 public function put($id)
 {
     $results = array();
     $metaData = new \Phalcon\Mvc\Model\MetaData\Memory();
     $request = $this->di->get('requestBody');
     $option = Options::findFirstById($id);
     if (!$option) {
         throw new HTTPException("Not found", 404, array('dev' => 'Option does not exist', 'internalCode' => 'P1000', 'more' => ''));
     } else {
         $params['type'] = isset($request['type']) ? $request['type'] : $option->type;
         $params['name'] = isset($request['name']) ? $request['name'] : $option->name;
         $params['value'] = isset($request['value']) ? $request['value'] : $option->value;
         $params['label'] = isset($request['label']) ? $request['label'] : $option->label;
         $params['status'] = isset($request['status']) ? $request['status'] : $option->status;
         if ($option->save($params, $metaData->getColumnMap(new Options()))) {
             $results['id'] = $option->id;
         } else {
             throw new HTTPException("Request unable to be followed due to semantic errors", 422, array('dev' => $option->getMessages(), 'internalCode' => 'P1000', 'more' => ''));
         }
     }
     return $results;
 }