/** * Responds with information about updated inserted country * * @method post * @return json/xml data */ public function put($id) { $results = array(); $country = Country::findFirstById($id); if ($country) { $countryCollection = CountryCollection::findFirst(array(array('id' => $id))); if ($countryCollection != false) { $countryCollection->id = $country->id; $countryCollection->name = $country->name; $countryCollection->description = $country->description; $countryCollection->status = $country->status; $countryCollection->active = $country->active; $countryCollection->created = $country->created; $countryCollection->modified = $country->modified; $countryCollection->createdBy = $country->createdBy; $countryCollection->modifiedBy = $country->modifiedBy; $countryCollection->save(); $results['id'] = $country->id; } } return $results; }
/** * Responds with information about updated inserted company * * @method post * @return json/xml data */ public function put($id) { $results = array(); $countryOption = CountryOptions::findFirstById($id); if ($countryOption) { $countryOptionsCollection = CountryOptionsCollection::findFirst(array(array('id' => $id))); if ($countryOptionsCollection != false) { $countryOptionCollection->id = $countryOption->id; $countryOptionCollection->countryId = $countryOption->countryId; $countryOptionCollection->name = $countryOption->name; $countryOptionCollection->value = $countryOption->value; $countryOptionCollection->label = $countryOption->label; $countryOptionCollection->status = $countryOption->status; $countryOptionCollection->active = $countryOption->active; $countryOptionCollection->editable = $countryOption->editable; $countryOptionCollection->visibility = $countryOption->active; $countryOptionCollection->created = $countryOption->created; $countryOptionCollection->modified = $countryOption->modified; $countryOptionCollection->createdBy = $countryOption->createdBy; $countryOptionCollection->modifiedBy = $countryOption->modifiedBy; $success = $countryOptionsCollection->save(); if ($success) { if (1 == $countryOption->status) { $country = Country::findFirst(array(array('id' => $countryOption->countryId))); if ($country) { $name = $countryOption->name; $country->{$name} = $countryOption->value; $country->save(); $results['id'] = $countryOption->id; } } } } } return $results; }