aboutsummaryrefslogtreecommitdiff
path: root/classes/Client.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/Client.php')
-rw-r--r--classes/Client.php14
1 files changed, 2 insertions, 12 deletions
diff --git a/classes/Client.php b/classes/Client.php
index acae192..0f0a2f8 100644
--- a/classes/Client.php
+++ b/classes/Client.php
@@ -40,12 +40,7 @@ class Client extends Model {
* @return int[] The ids
*/
public function getContactIds() {
- $ids = array();
- $contacts = $this->pdo->query("SELECT `id` FROM `".Constants::db_prefix."contact` WHERE `clientId`={$this->id}")->fetchAll(PDO::FETCH_ASSOC);
- foreach ($contacts as $contact) {
- $ids[] = $contact['id'];
- }
- return $ids;
+ return Contact::searchIds($this->pdo, ['`clientId`=?'], [$this->id]);
}
/**
@@ -58,12 +53,7 @@ class Client extends Model {
* @return contact[] An array indexed by id of instances of the contact class
*/
public function getContacts() {
- $ids = $this->getContactIds();
- $contacts = array();
- foreach ($ids as $id) {
- $contacts[$id] = new Contact($this->pdo, $id);
- }
- return $contacts;
+ return Contact::search($this->pdo, ['`clientId`=?'], [$this->id]);
}
//------------------------------------------------------------------------------