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
8c2c0a20
Unverified
Commit
8c2c0a20
authored
4 years ago
by
Seamus Lee
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #18607 from eileenmcnaughton/website
#2046
Rationalise add vs create on website BAO
parents
ee523fb8
22911720
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Core/BAO/Website.php
+9
-16
9 additions, 16 deletions
CRM/Core/BAO/Website.php
Civi/Api4/Generic/Traits/DAOActionTrait.php
+0
-1
0 additions, 1 deletion
Civi/Api4/Generic/Traits/DAOActionTrait.php
with
9 additions
and
17 deletions
CRM/Core/BAO/Website.php
+
9
−
16
View file @
8c2c0a20
...
...
@@ -24,9 +24,11 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website {
* Create or update Website record.
*
* @param array $params
*
* @return CRM_Core_DAO_Website
* @throws \CRM_Core_Exception
*/
public
static
function
add
(
$params
)
{
public
static
function
create
(
$params
)
{
return
self
::
writeRecord
(
$params
);
}
...
...
@@ -36,23 +38,13 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website {
* If called in a legacy manner this, temporarily, fails back to calling the legacy function.
*
* @param array $params
* @param int $contactID
* @param bool $skipDelete
*
* @return bool|CRM_Core_BAO_Website
* @throws \CRM_Core_Exception
*/
public
static
function
create
(
$params
,
$contactID
=
NULL
,
$skipDelete
=
NULL
)
{
if
(
$skipDelete
!==
NULL
||
(
$contactID
&&
!
is_array
(
$contactID
)))
{
\Civi
::
log
()
->
warning
(
ts
(
'Calling website:create with vars other than $params is deprecated. Use process'
),
[
'civi.tag'
=>
'deprecated'
]);
return
self
::
process
(
$params
,
$contactID
,
$skipDelete
);
}
foreach
(
$params
as
$key
=>
$value
)
{
if
(
is_numeric
(
$key
))
{
\Civi
::
log
()
->
warning
(
ts
(
'Calling website:create for multiple websites $params is deprecated. Use process'
),
[
'civi.tag'
=>
'deprecated'
]);
return
self
::
process
(
$params
,
$contactID
,
$skipDelete
);
}
}
return
self
::
add
(
$params
);
public
static
function
add
(
$params
)
{
CRM_Core_Error
::
deprecatedFunctionWarning
(
'use apiv4'
);
return
self
::
create
(
$params
);
}
/**
...
...
@@ -65,6 +57,7 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website {
* @param bool $skipDelete
*
* @return bool
* @throws \CRM_Core_Exception
*/
public
static
function
process
(
$params
,
$contactID
,
$skipDelete
)
{
if
(
empty
(
$params
))
{
...
...
@@ -87,7 +80,7 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website {
}
if
(
!
empty
(
$values
[
'url'
]))
{
$values
[
'contact_id'
]
=
$contactID
;
self
::
add
(
$values
);
self
::
create
(
$values
);
}
elseif
(
$skipDelete
&&
!
empty
(
$values
[
'id'
]))
{
self
::
del
(
$values
[
'id'
]);
...
...
This diff is collapsed.
Click to expand it.
Civi/Api4/Generic/Traits/DAOActionTrait.php
+
0
−
1
View file @
8c2c0a20
...
...
@@ -110,7 +110,6 @@ trait DAOActionTrait {
$oddballs
=
[
'EntityTag'
=>
'add'
,
'GroupContact'
=>
'add'
,
'Website'
=>
'add'
,
];
$method
=
$oddballs
[
$this
->
getEntityName
()]
??
'create'
;
if
(
!
method_exists
(
$baoName
,
$method
))
{
...
...
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