diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-06-15 14:18:23 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-06-15 14:18:23 -0700 |
commit | 9504f71efcadc7ed27f6f09e5d663e8025bf3b86 (patch) | |
tree | da928864da7bd58cdbae3f9231828248a9abeacb /modules/gallery/helpers/item_rest.php | |
parent | 2492280cc0ec9eb64a8daeccc7b5698ece7fea66 (diff) |
Fix for ticket #1118. Create a item::save_with_retries helper method, which encapsulates saving an item and handling name and slug conflicts. Call this instead of doing a save directly.
Diffstat (limited to 'modules/gallery/helpers/item_rest.php')
-rw-r--r-- | modules/gallery/helpers/item_rest.php | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php index 692d0895..74fab2e7 100644 --- a/modules/gallery/helpers/item_rest.php +++ b/modules/gallery/helpers/item_rest.php @@ -112,8 +112,6 @@ class item_rest_Core { } break; - case "parent": - break; default: if (property_exists($entity, $key)) { $item->$key = $entity->$key; @@ -126,7 +124,7 @@ class item_rest_Core { $parent = rest::resolve($entity->parent); item::move($item, $parent); } else { - $item->save(); + $item::save_with_retries($item); } } @@ -157,7 +155,7 @@ class item_rest_Core { $item->title = isset($entity->title) ? $entity->title : $entity->name; $item->description = isset($entity->description) ? $entity->description : null; $item->slug = isset($entity->slug) ? $entity->slug : null; - $item->save(); + $item::save_with_retries($item); break; case "photo": @@ -172,7 +170,7 @@ class item_rest_Core { $item->title = isset($entity->title) ? $entity->title : $entity->name; $item->description = isset($entity->description) ? $entity->description : null; $item->slug = isset($entity->slug) ? $entity->slug : null; - $item->save(); + $item::save_with_retries($item); break; default: |