Skip to content
Snippets Groups Projects
Commit 9e86e454 authored by Tim Steiner's avatar Tim Steiner
Browse files

Handle ::find(NULL) on Group and User models.

parent d30c551f
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,9 @@ class Auth_GroupModel extends Unl_Model
public static function find($id)
{
if (Unl_Util::isArray($id) && count($id) == 0) {
return new Unl_Model_Collection(__CLASS__);
return new Unl_Model_Collection(__CLASS__);
} else if ($id === NULL) {
return null;
}
$db = Zend_Registry::get('db');
......@@ -62,6 +64,12 @@ class Auth_GroupModel extends Unl_Model
*/
static public function findByUser($user, $implicitMemberships = true)
{
if (Unl_Util::isArray($user) && count($user) == 0) {
return new Unl_Model_Collection(__CLASS__);
} else if ($user === NULL) {
return null;
}
$db = Zend_Registry::get('db');
$select = new Zend_Db_Select($db);
......@@ -139,6 +147,12 @@ class Auth_GroupModel extends Unl_Model
*/
static public function findByChildGroup($group, $impliedMemberships = true)
{
if (Unl_Util::isArray($group) && count($group) == 0) {
return new Unl_Model_Collection(__CLASS__);
} else if ($group === NULL) {
return null;
}
$db = Zend_Registry::get('db');
$select = new Zend_Db_Select($db);
......@@ -193,6 +207,12 @@ class Auth_GroupModel extends Unl_Model
*/
static public function findByParentGroup($group, $impliedMemberships = true, $primaryGroups = false)
{
if (Unl_Util::isArray($group) && count($group) == 0) {
return new Unl_Model_Collection(__CLASS__);
} else if ($group === NULL) {
return null;
}
$db = Zend_Registry::get('db');
$select = new Zend_Db_Select($db);
......
......@@ -11,12 +11,11 @@ class Auth_UserModel extends Unl_Model {
static public function find($id)
{
if (Unl_Util::isArray($id) && count($id) == 0) {
return new Unl_Model_Collection(__CLASS__);
}
if ($id === null) {
return null;
}
if (Unl_Util::isArray($id) && count($id) == 0) {
return new Unl_Model_Collection(__CLASS__);
} else if ($id === NULL) {
return null;
}
$db = Zend_Registry::get('db');
......@@ -108,6 +107,12 @@ class Auth_UserModel extends Unl_Model {
*/
static public function findByParentGroup($group, $impliedMemberships = true)
{
if (Unl_Util::isArray($group) && count($group) == 0) {
return new Unl_Model_Collection(__CLASS__);
} else if ($group === NULL) {
return null;
}
$db = Zend_Registry::get('db');
$select = new Zend_Db_Select($db);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment