diff options
| author | yogg@epsina.com <evan.pisani@etudiant.univ-rennes1.fr> | 2016-01-31 19:57:05 +0100 |
|---|---|---|
| committer | yogg@epsina.com <evan.pisani@etudiant.univ-rennes1.fr> | 2016-01-31 19:57:05 +0100 |
| commit | e2dacb129e75111559a6f16252009b031c2baeb4 (patch) | |
| tree | 1dafd884d00a8a7a9477b8629df8a64b8ad134cf /server/core/Image.php | |
| parent | 8ad2a0aacd280ec29a6b53e7663b968068f89ab9 (diff) | |
Modification of options for update_image
Diffstat (limited to 'server/core/Image.php')
| -rw-r--r-- | server/core/Image.php | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/server/core/Image.php b/server/core/Image.php index 37efa9d..cfd190d 100644 --- a/server/core/Image.php +++ b/server/core/Image.php @@ -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; } |
