Modification of options for update_image
This commit is contained in:
parent
8ad2a0aacd
commit
e2dacb129e
2 changed files with 20 additions and 12 deletions
|
@ -101,13 +101,25 @@ class Image {
|
|||
public function update_image($id, array $opt){
|
||||
$service = $this->oidentity;
|
||||
$image = $service->getImage($id);
|
||||
$image->update([
|
||||
'minDisk' => $opt['minDisk'],
|
||||
'minRam' => $opt['minRam'],
|
||||
'name' => $opt['name'],
|
||||
'protected' => $opt['protected'],
|
||||
'visibility' => $opt['visibility'],
|
||||
]);
|
||||
$options = Array();
|
||||
|
||||
// Voir vérification des types
|
||||
if(array_key_exists('name', $opt)){ //string
|
||||
$options['name'] = $opt['name'];
|
||||
}
|
||||
if(array_key_exists('minDisk', $opt)){ //int
|
||||
$options['minDisk'] = $opt['minDisk'];
|
||||
}
|
||||
if(array_key_exists('minRam', $opt)){ // int
|
||||
$options['minRam'] = $opt['minRam'];
|
||||
}
|
||||
if(array_key_exists('protected', $opt)){ // boolean
|
||||
$options['protected'] = $opt['protected'];
|
||||
}
|
||||
if(array_key_exists('visibility', $opt)){ // public, private
|
||||
$options['visibility'] = $opt['visibility'];
|
||||
}
|
||||
$image->update($options);
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue