summaryrefslogtreecommitdiff
path: root/core/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-11-08 07:48:36 +0000
committerBharat Mediratta <bharat@menalto.com>2008-11-08 07:48:36 +0000
commit418c0aab69a72da512646541be2d88a866cb9fdb (patch)
treefea9ea900fbf33d3e94082b901922ad74b832f50 /core/helpers
parentea7cc4f46edc730ff873c579a6c63490d24496a6 (diff)
Create permanent owner_id column in the item table, and use a soft
relationship to bind the two. To do this, I overrode __get in Item_Model so that $item->owner returns the appropriate User_Model.
Diffstat (limited to 'core/helpers')
-rw-r--r--core/helpers/album.php4
-rw-r--r--core/helpers/core_installer.php1
-rw-r--r--core/helpers/photo.php4
3 files changed, 5 insertions, 4 deletions
diff --git a/core/helpers/album.php b/core/helpers/album.php
index 3c97f7e8..2801c570 100644
--- a/core/helpers/album.php
+++ b/core/helpers/album.php
@@ -32,13 +32,13 @@ class Album_Core {
* @param string $description (optional) the longer description of this album
* @return Item_Model
*/
- static function create($parent_id, $name, $title, $description=null, $user_id = null) {
+ static function create($parent_id, $name, $title, $description=null, $owner_id = null) {
$album = ORM::factory("item");
$album->type = "album";
$album->title = $title;
$album->description = $description;
$album->name = $name;
- $album->user_id = $user_id;
+ $album->owner_id = $owner_id;
while (ORM::Factory("item")
->where("parent_id", $parent_id)
diff --git a/core/helpers/core_installer.php b/core/helpers/core_installer.php
index df194497..a3350f22 100644
--- a/core/helpers/core_installer.php
+++ b/core/helpers/core_installer.php
@@ -53,6 +53,7 @@ class core_installer {
`thumbnail_height` int(9) default NULL,
`resize_width` int(9) default NULL,
`resize_height` int(9) default NULL,
+ `owner_id` int(9) default NULL,
PRIMARY KEY (`id`),
KEY `parent_id` (`parent_id`),
KEY `type` (`type`))
diff --git a/core/helpers/photo.php b/core/helpers/photo.php
index 231e3a9c..44350f2f 100644
--- a/core/helpers/photo.php
+++ b/core/helpers/photo.php
@@ -33,13 +33,13 @@ class Photo_Core {
* @param string $description (optional) the longer description of this photo
* @return Item_Model
*/
- static function create($parent_id, $filename, $name, $title, $description=null, $user_id = null) {
+ static function create($parent_id, $filename, $name, $title, $description=null, $owner_id = null) {
$photo = ORM::factory("item");
$photo->type = "photo";
$photo->title = $title;
$photo->description = $description;
$photo->name = $name;
- $photo->user_id = $user_id;
+ $photo->owner_id = $owner_id;
$pi = pathinfo(basename($filename));
if (empty($pi["extension"])) {