/** * Return companies from an array of ID-s * * @param array $ids * @return array */ function findByIds($ids) { if (is_foreachable($ids)) { foreach ($ids as $k => $v) { $ids[$k] = (int) $v; } // foreach $companies_table = TABLE_PREFIX . 'companies'; return Companies::findBySQL("SELECT * FROM {$companies_table} WHERE id IN (" . implode(', ', $ids) . ") ORDER BY is_owner DESC, name"); } // if return null; }