function getByAccountAndContact($account, $user) { if ($account instanceof MailAccount && $user instanceof Contact) { return MailAccountContacts::findOne(array('conditions' => array('`account_id` = ? AND `contact_id` = ?', $account->getId(), $user->getId()))); } return null; }
private function getDefaultAccountId($user = null) { if (!$user) $user = logged_user(); $default_account = MailAccountContacts::findOne(array('conditions' => array('`contact_id` = ? AND `is_default` = ?', $user->getId(), true))); if ($default_account instanceof MailAccountContact && $default_account->getAccount() instanceof MailAccount) { return $default_account->getAccount()->getId(); } return 0; }
function getByAccountAndContact($account, $user) { return MailAccountContacts::findOne(array('conditions' => array('`account_id` = ? AND `contact_id` = ?', $account->getId(), $user->getId()))); }