summaryrefslogtreecommitdiffstats
path: root/application/models
diff options
context:
space:
mode:
Diffstat (limited to 'application/models')
-rw-r--r--application/models/BootMenuEntriesMapper.php18
-rw-r--r--application/models/BootOsMapper.php4
-rw-r--r--application/models/ConfigMapper.php13
-rw-r--r--application/models/GroupMapper.php13
-rw-r--r--application/models/MembershipMapper.php13
-rw-r--r--application/models/PersonMapper.php13
6 files changed, 61 insertions, 13 deletions
diff --git a/application/models/BootMenuEntriesMapper.php b/application/models/BootMenuEntriesMapper.php
index 7a2da59..a0a5309 100644
--- a/application/models/BootMenuEntriesMapper.php
+++ b/application/models/BootMenuEntriesMapper.php
@@ -30,6 +30,24 @@ class Application_Model_BootMenuEntriesMapper
echo "Error message 2: " . $e->getMessage() . "\n";
}
}
+
+ public function findByArray($criteria, $value)
+ {
+ try{
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($criteria . ' = ?', $value)
+ ->order('order');
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ return $result;
+
+ }catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
public function setDbTable($dbTable)
{
diff --git a/application/models/BootOsMapper.php b/application/models/BootOsMapper.php
index a6e9a7f..66de08d 100644
--- a/application/models/BootOsMapper.php
+++ b/application/models/BootOsMapper.php
@@ -14,7 +14,9 @@ class Application_Model_BootOsMapper
->where($criteria . ' = ?', $value);
$stmt = $select->query();
$result = $stmt->fetchAll();
+
return $result;
+
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
}
@@ -87,7 +89,7 @@ class Application_Model_BootOsMapper
$entry->setID($row->bootosID)->setConfigID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setTitle($row->title)->setPath_init($row->path_init)->setPath_kernel($row->path_kernel)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public);
- $entries[] = $entry;
+ $entries[$row->bootosID] = $entry;
}
return $entries;
}
diff --git a/application/models/ConfigMapper.php b/application/models/ConfigMapper.php
index da7a073..d8a23c4 100644
--- a/application/models/ConfigMapper.php
+++ b/application/models/ConfigMapper.php
@@ -66,9 +66,14 @@ class Application_Model_ConfigMapper
}
}
- public function find($id)
+ public function find($id, Application_Model_Config $config = null)
{
- $config = new Application_Model_Config();
+ if($config == null){
+ $return = true;
+ }
+ if($return){
+ $config = new Application_Model_Config();
+ }
$result = $this->getDbTable()->find($id);
if (0 == count($result)) {
return;
@@ -77,7 +82,9 @@ class Application_Model_ConfigMapper
$row = $result->current();
$config->setID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setCreated($row->created)->setShellscript($row->shellscript)->setTitle($row->title);
- return $config;
+ if($return){
+ return $config;
+ }
}
public function fetchAll()
diff --git a/application/models/GroupMapper.php b/application/models/GroupMapper.php
index d43b3f1..463f3d1 100644
--- a/application/models/GroupMapper.php
+++ b/application/models/GroupMapper.php
@@ -66,9 +66,14 @@ class Application_Model_GroupMapper
}
}
- public function find($id)
+ public function find($id,Application_Model_Group $group = null)
{
- $group = new Application_Model_Group();
+ if($group == null){
+ $return = true;
+ }
+ if($return){
+ $group = new Application_Model_Group();
+ }
$result = $this->getDbTable()->find($id);
if (0 == count($result)) {
return;
@@ -77,7 +82,9 @@ class Application_Model_GroupMapper
$row = $result->current();
$group->setID($row->groupID)->setTitle($row->title)->setDescription($row->description);
- return $group;
+ if($return){
+ return $group;
+ }
}
public function fetchAll()
diff --git a/application/models/MembershipMapper.php b/application/models/MembershipMapper.php
index 2a6e57d..313248c 100644
--- a/application/models/MembershipMapper.php
+++ b/application/models/MembershipMapper.php
@@ -66,9 +66,14 @@ class Application_Model_MembershipMapper
}
}
- public function find($id)
+ public function find($id, Application_Model_Membership $membership = null)
{
- $membership = new Application_Model_Membership();
+ if($membership == null){
+ $return = true;
+ }
+ if($return){
+ $membership = new Application_Model_Membership();
+ }
$result = $this->getDbTable()->find($id);
if (0 == count($result)) {
return;
@@ -77,7 +82,9 @@ class Application_Model_MembershipMapper
$row = $result->current();
$membership->setID($row->membershipID)->setGroupID($row->groupID)->setRoleID($row->roleID)->setPersonID($row->personID);
- return $membership;
+ if($return){
+ return $membership;
+ }
}
public function fetchAll()
diff --git a/application/models/PersonMapper.php b/application/models/PersonMapper.php
index 038670d..b2cbf39 100644
--- a/application/models/PersonMapper.php
+++ b/application/models/PersonMapper.php
@@ -66,9 +66,14 @@ class Application_Model_PersonMapper
}
}
- public function find($id)
+ public function find($id,Application_Model_Person $person = null)
{
- $person = new Application_Model_Person();
+ if($person == null){
+ $return = true;
+ }
+ if($return){
+ $person = new Application_Model_Person();
+ }
$result = $this->getDbTable()->find($id);
if (0 == count($result)) {
return;
@@ -77,7 +82,9 @@ class Application_Model_PersonMapper
$row = $result->current();
$person->setID($row->personID)->setTitle($row->title)->setName($row->name)->setFirstname($row->firstname)->setStreet($row->street)->setHousenumber($row->housenumber)->setCity($row->city)->setPostalcode($row->postalcode)->setLogindate($row->logindate)->setRegisterdate($row->registerdate)->setEmail($row->email)->setLogin($row->login)->setPassword($row->password)->setPasswordSalt($row->password_salt);
- return $person;
+ if($return){
+ return $person;
+ }
}
public function fetchAll()