Created
January 17, 2013 01:20
-
-
Save sevein/4552691 to your computer and use it in GitHub Desktop.
Fix for issue #4539 for ICA-AtoM 1.3.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/apps/qubit/modules/user/actions/indexAction.class.php b/apps/qubit/modules/user/actions/indexAction.class.php | |
index 806c432..57dc69f 100644 | |
--- a/apps/qubit/modules/user/actions/indexAction.class.php | |
+++ b/apps/qubit/modules/user/actions/indexAction.class.php | |
@@ -32,6 +32,6 @@ class UserIndexAction extends sfAction | |
} | |
} | |
- $this->amountOfNotes = count($this->resource->notes); | |
+ $this->amountOfNotes = count($this->resource->getNotes()); | |
} | |
} | |
diff --git a/lib/model/QubitUser.php b/lib/model/QubitUser.php | |
index 39a947f..53ba4ca 100644 | |
--- a/lib/model/QubitUser.php | |
+++ b/lib/model/QubitUser.php | |
@@ -27,40 +27,6 @@ class QubitUser extends BaseUser | |
return (string) $this->username; | |
} | |
- public function __get($name) | |
- { | |
- $args = func_get_args(); | |
- | |
- $options = array(); | |
- if (1 < count($args)) | |
- { | |
- $options = $args[1]; | |
- } | |
- | |
- switch ($name) | |
- { | |
- // Return QubitNote objects that matches USER_ID with this resource | |
- // BaseUser relies in BaseObject, which looks up QubitUser.OBJECT_ID column | |
- case 'notes': | |
- | |
- if (!isset($this->refFkValues['notes'])) | |
- { | |
- if (!isset($this->id)) | |
- { | |
- $this->refFkValues['notes'] = QubitQuery::create(); | |
- } | |
- else | |
- { | |
- $this->refFkValues['notes'] = self::getnotesById($this->id, array('self' => $this) + $options); | |
- } | |
- } | |
- | |
- return $this->refFkValues['notes']; | |
- } | |
- | |
- return call_user_func_array(array($this, 'BaseUser::__get'), $args); | |
- } | |
- | |
public function save($connection = null) | |
{ | |
parent::save($connection); | |
@@ -224,6 +190,14 @@ class QubitUser extends BaseUser | |
} | |
} | |
+ public function getNotes() | |
+ { | |
+ $criteria = new Criteria; | |
+ $criteria->add(QubitNote::USER_ID, $this->id); | |
+ | |
+ return QubitNote::get($criteria); | |
+ } | |
+ | |
/** | |
* Get an array of QubitRepository objects where the current user has been | |
* added explicit access via its own user of any of its groups |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment