Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
civirules
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mattwire
civirules
Commits
b06144b6
Unverified
Commit
b06144b6
authored
8 months ago
by
Sandor Semsey
Browse files
Options
Downloads
Patches
Plain Diff
CRM_Civirules_BAO_CiviRulesCondition::getConditionObjectById: cache condition class names
parent
9c892bac
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Civirules/BAO/CiviRulesCondition.php
+22
-12
22 additions, 12 deletions
CRM/Civirules/BAO/CiviRulesCondition.php
with
22 additions
and
12 deletions
CRM/Civirules/BAO/CiviRulesCondition.php
+
22
−
12
View file @
b06144b6
...
...
@@ -7,6 +7,11 @@
*/
class
CRM_Civirules_BAO_CiviRulesCondition
extends
CRM_Civirules_DAO_Condition
{
/**
* @var array
*/
protected
static
$conditionClassNames
=
[];
/**
* Function to get values
*
...
...
@@ -139,21 +144,26 @@ class CRM_Civirules_BAO_CiviRulesCondition extends CRM_Civirules_DAO_Condition {
* @throws Exception if abort is set to true and class does not exist or is not valid
*/
public
static
function
getConditionObjectById
(
int
$conditionID
,
bool
$abort
=
TRUE
)
{
$condition
=
new
CRM_Civirules_BAO_Condition
();
$condition
->
id
=
$conditionID
;
if
(
!
$condition
->
find
(
TRUE
))
{
if
(
$abort
)
{
throw
new
Exception
(
'CiviRule could not find condition'
);
if
(
isset
(
self
::
$conditionClassNames
[
$conditionID
]))
{
$className
=
self
::
$conditionClassNames
[
$conditionID
];
}
else
{
$condition
=
new
CRM_Civirules_BAO_Condition
();
$condition
->
id
=
$conditionID
;
if
(
!
$condition
->
find
(
TRUE
))
{
if
(
$abort
)
{
throw
new
Exception
(
'CiviRule could not find condition'
);
}
return
FALSE
;
}
return
FALSE
;
}
$className
=
$condition
->
class_name
;
if
(
!
class_exists
(
$className
))
{
if
(
$abort
)
{
throw
new
Exception
(
'CiviRule condition class "'
.
$className
.
'" does not exist'
);
$className
=
$condition
->
class_name
;
if
(
!
class_exists
(
$className
))
{
if
(
$abort
)
{
throw
new
Exception
(
'CiviRule condition class "'
.
$className
.
'" does not exist'
);
}
return
FALSE
;
}
return
FALSE
;
self
::
$conditionClassNames
[
$conditionID
]
=
$className
;
}
$object
=
new
$className
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment