protected static final function _fetch(&$pairs, $all = false) { $select = 'SELECT * FROM `' . static::$contacts_table . '`'; $where = Db::prepWhere($pairs); $func = $all ? 'fetchAll' : 'fetch'; return Db::_get()->{$func}($select . array_shift($where), $where); }
public static final function fetchContacts($account_id) { $pairs[static::$contacts_table . '.contact_account_table'] = static::$accounts_table; $where = Db::prepWhere(array(static::$account_key => $account_id)); return Db::_get()->fetchAll('SELECT * FROM `' . static::$contacts_table . '`' . array_shift($where), $where); }