/** * @param int $id * * @return mixed */ public static function &build($id) { if (!self::$_cache) { self::$_cache = array(); } if (array_key_exists($id, self::$_cache)) { return self::$_cache[$id]; } // check if this entry exists in db // if so retrieve and return self::$_cache[$id] = self::retrieve($id); if (self::$_cache[$id]) { return self::$_cache[$id]; } self::$_cache[$id] = CRM_ACL_BAO_ACL::getAllByContact($id); self::store($id, self::$_cache[$id]); return self::$_cache[$id]; }