From bf7ab8904aa9ccbb201b1ef9634a8b13834e5f6d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 7 Dec 2008 08:46:44 +0000 Subject: Change ORM_MPTT::add_to_parent() to take an ORM instead of an id so that it's consistent with ORM_MPTT::move_to() --- core/helpers/album.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'core/helpers/album.php') diff --git a/core/helpers/album.php b/core/helpers/album.php index 3e3b6054..83bbfbab 100644 --- a/core/helpers/album.php +++ b/core/helpers/album.php @@ -47,7 +47,12 @@ class album_Core { $album->name = "{$name}-" . rand(); } - $album = $album->add_to_parent($parent_id); + $parent = ORM::factory("item", $parent_id); + if (!$parent->loaded) { + throw new Exception("@todo INVALID_PARENT_ID"); + } + + $album = $album->add_to_parent($parent); mkdir($album->file_path()); $thumbnail_dir = dirname($album->thumbnail_path()); if (!file_exists($thumbnail_dir)) { -- cgit v1.2.3