Skip to content

Commit

Permalink
10.5: * [Profiles/Performance] Profile tabs per record type now use t…
Browse files Browse the repository at this point in the history
…he cache rather than a database query.
  • Loading branch information
jstanden committed Sep 4, 2024
1 parent 9d1611c commit baf9a80
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions features/cerberusweb.core/api/dao/profile_tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,27 +194,11 @@ static function getAll($nocache=false) {
}

static function getByContext($context) {
// [TODO] Cache by context?
// Ensure the context is legitimate
if(false == Extension_DevblocksContext::get($context))
if(!Extension_DevblocksContext::get($context))
return [];

$objects = self::getWhere(
sprintf("%s = %s",
Cerb_ORMHelper::escape(self::CONTEXT),
Cerb_ORMHelper::qstr($context)
),
DAO_ProfileTab::POS,
true,
null,
Cerb_ORMHelper::OPT_GET_MASTER_ONLY
);

if(!is_array($objects))
return [];

return $objects;
return array_filter(self::getAll(), fn($profile_tab) => $profile_tab->context == $context);
}

/**
Expand Down

0 comments on commit baf9a80

Please sign in to comment.