Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
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
Development
CiviCRM Core
Commits
1ef36fef
Unverified
Commit
1ef36fef
authored
3 years ago
by
Eileen McNaughton
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #20331 from mattwire/suppresslegacywarnings
Allow legacy warnings to be fully suppressed in PropertyBag
parents
1f2aed5f
05fd2f63
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Civi/Payment/PropertyBag.php
+17
-12
17 additions, 12 deletions
Civi/Payment/PropertyBag.php
with
17 additions
and
12 deletions
Civi/Payment/PropertyBag.php
+
17
−
12
View file @
1ef36fef
...
...
@@ -153,11 +153,13 @@ class PropertyBag implements \ArrayAccess {
}
catch
(
InvalidArgumentException
$e
)
{
CRM_Core_Error
::
deprecatedFunctionWarning
(
"proper getCustomProperty('
$offset
') for non-core properties. "
.
$e
->
getMessage
(),
"PropertyBag array access to get '
$offset
'"
);
if
(
!
$this
->
getSuppressLegacyWarnings
())
{
CRM_Core_Error
::
deprecatedFunctionWarning
(
"proper getCustomProperty('
$offset
') for non-core properties. "
.
$e
->
getMessage
(),
"PropertyBag array access to get '
$offset
'"
);
}
try
{
return
$this
->
getCustomProperty
(
$offset
,
'default'
);
...
...
@@ -172,10 +174,12 @@ class PropertyBag implements \ArrayAccess {
}
}
CRM_Core_Error
::
deprecatedFunctionWarning
(
"get"
.
ucfirst
(
$offset
)
.
"()"
,
"PropertyBag array access for core property '
$offset
'"
);
if
(
!
$this
->
getSuppressLegacyWarnings
())
{
CRM_Core_Error
::
deprecatedFunctionWarning
(
"get"
.
ucfirst
(
$offset
)
.
"()"
,
"PropertyBag array access for core property '
$offset
'"
);
}
return
$this
->
get
(
$prop
,
'default'
);
}
...
...
@@ -265,7 +269,7 @@ class PropertyBag implements \ArrayAccess {
throw
new
\InvalidArgumentException
(
"Unknown property '
$prop
'."
);
}
// Remaining case is legacy name that's been translated.
if
(
!
$this
->
s
uppressLegacyWarnings
)
{
if
(
!
$this
->
getS
uppressLegacyWarnings
()
)
{
CRM_Core_Error
::
deprecatedFunctionWarning
(
"Canonical property name '
$newName
'"
,
"Legacy property name '
$prop
'"
);
}
...
...
@@ -341,13 +345,14 @@ class PropertyBag implements \ArrayAccess {
// Suppress legacy warnings for merging an array of data as this
// suits our migration plan at this moment. Future behaviour may differ.
// @see https://github.com/civicrm/civicrm-core/pull/17643
$this
->
suppressLegacyWarnings
=
TRUE
;
$suppressLegacyWarnings
=
$this
->
getSuppressLegacyWarnings
();
$this
->
setSuppressLegacyWarnings
(
TRUE
);
foreach
(
$data
as
$key
=>
$value
)
{
if
(
$value
!==
NULL
&&
$value
!==
''
)
{
$this
->
offsetSet
(
$key
,
$value
);
}
}
$this
->
suppressLegacyWarnings
=
FALSE
;
$this
->
s
etS
uppressLegacyWarnings
(
$suppressLegacyWarnings
)
;
}
/**
...
...
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