/** * Replace all existing attributes with the provided set * * @param Organization $organization * @param array $attributes * @return array The server representation of the replaced attributes */ public function replaceAttributes(Organization $organization, array $attributes) { $url = self::makeAttributeUrl($organization->id); $data = json_encode(array('attribute' => $attributes)); $response = $this->service->prepAndSend($url, array(200), 'PUT', $data, true); $response = json_decode($response); $result = array(); foreach ($response->attribute as $attr) { $result[] = Attribute::createFromJSON($attr); } return $result; }
/** * Replace all existing attributes with the provided set, the server's representation of the attributes will be * returned. * * @param array $attributes * @return array */ public function replaceAttributes(array $attributes) { $url = self::makeAttributeUrl(); $data = json_encode(array("attribute" => $attributes)); $replaced = $this->service->prepAndSend($url, array(200), 'PUT', $data, true); $replaced = json_decode($replaced); $result = array(); foreach ($replaced->attribute as $attr) { $result[] = Attribute::createFromJSON($attr); } return $result; }