* @}
*/
+ /**
+ * @param array $fields Array of selected fields, empty for all
+ * @param array $condition Array of fields for condition
+ * @param array $params Array of several parameters
+ * @return array
+ * @throws \Exception
+ */
+ public static function select(array $fields = [], array $condition = [], array $params = [])
+ {
+ $statement = DBA::select('contact', $fields, $condition, $params);
+
+ return DBA::toArray($statement);
+ }
+
/**
* @param integer $id
* @return array|boolean Contact record if it exists, false otherwise
return ['public' => $pcid, 'user' => $ucid];
}
+ /**
+ * Returns contact details for a given contact id in combination with a user id
+ *
+ * @param int $cid A contact ID
+ * @param int $uid The User ID
+ * @param array $fields The selected fields for the contact
+ *
+ * @return array The contact details
+ *
+ * @throws \Exception
+ */
+ public static function getContactForUser($cid, $uid, array $fields = [])
+ {
+ $contact = DBA::selectFirst('contact', $fields, ['id' => $cid, 'uid' => $uid]);
+
+ if (!DBA::isResult($contact)) {
+ return [];
+ } else {
+ return $contact;
+ }
+ }
+
/**
* @brief Block contact id for user id
*