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
750c4ae0
Unverified
Commit
750c4ae0
authored
4 years ago
by
colemanw
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #17210 from colemanw/noMulti-5.24
APIv4 - Don't advertise implicit multi-joins in Explorer
parents
0aa3fbca
28021ad7
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/Api4/Page/Api4Explorer.php
+10
-1
10 additions, 1 deletion
CRM/Api4/Page/Api4Explorer.php
ang/api4Explorer/Explorer.js
+3
-5
3 additions, 5 deletions
ang/api4Explorer/Explorer.js
with
13 additions
and
6 deletions
CRM/Api4/Page/Api4Explorer.php
+
10
−
1
View file @
750c4ae0
...
...
@@ -10,6 +10,8 @@
+--------------------------------------------------------------------+
*/
use
Civi\Api4\Service\Schema\Joinable\Joinable
;
/**
*
* @package CRM
...
...
@@ -22,11 +24,18 @@ class CRM_Api4_Page_Api4Explorer extends CRM_Core_Page {
public
function
run
()
{
$apiDoc
=
new
ReflectionFunction
(
'civicrm_api4'
);
$groupOptions
=
civicrm_api4
(
'Group'
,
'getFields'
,
[
'loadOptions'
=>
TRUE
,
'select'
=>
[
'options'
,
'name'
],
'where'
=>
[[
'name'
,
'IN'
,
[
'visibility'
,
'group_type'
]]]]);
// Don't show n-to-many joins in Explorer
$entityLinks
=
(
array
)
civicrm_api4
(
'Entity'
,
'getLinks'
,
[],
[
'entity'
=>
'links'
]);
foreach
(
$entityLinks
as
$entity
=>
$links
)
{
$entityLinks
[
$entity
]
=
array_filter
(
$links
,
function
(
$link
)
{
return
$link
[
'joinType'
]
!=
Joinable
::
JOIN_TYPE_ONE_TO_MANY
;
});
}
$vars
=
[
'operators'
=>
\CRM_Core_DAO
::
acceptedSQLOperators
(),
'basePath'
=>
Civi
::
resources
()
->
getUrl
(
'civicrm'
),
'schema'
=>
(
array
)
\Civi\Api4\Entity
::
get
()
->
setChain
([
'fields'
=>
[
'$name'
,
'getFields'
]])
->
execute
(),
'links'
=>
(
array
)
\Civi\Api4\Entity
::
getLinks
()
->
execute
()
,
'links'
=>
$entityLinks
,
'docs'
=>
\Civi\Api4\Utils\ReflectionUtils
::
parseDocBlock
(
$apiDoc
->
getDocComment
()),
'groupOptions'
=>
array_column
((
array
)
$groupOptions
,
'options'
,
'name'
),
];
...
...
This diff is collapsed.
Click to expand it.
ang/api4Explorer/Explorer.js
+
3
−
5
View file @
750c4ae0
...
...
@@ -138,9 +138,8 @@
}
function
addJoins
(
fieldList
,
addWildcard
)
{
var
fields
=
_
.
cloneDeep
(
fieldList
),
fks
=
_
.
findWhere
(
links
,
{
entity
:
$scope
.
entity
})
||
{};
_
.
each
(
fks
.
links
,
function
(
link
)
{
var
fields
=
_
.
cloneDeep
(
fieldList
);
_
.
each
(
links
[
$scope
.
entity
],
function
(
link
)
{
var
linkFields
=
_
.
cloneDeep
(
entityFields
(
link
.
entity
)),
wildCard
=
addWildcard
?
[{
id
:
link
.
alias
+
'
.*
'
,
text
:
link
.
alias
+
'
.*
'
,
'
description
'
:
'
All core
'
+
link
.
entity
+
'
fields
'
}]
:
[];
if
(
linkFields
)
{
...
...
@@ -1066,8 +1065,7 @@
return
comboName
;
}
var
linkName
=
fieldNames
.
shift
(),
entityLinks
=
_
.
findWhere
(
links
,
{
entity
:
entity
}).
links
,
newEntity
=
_
.
findWhere
(
entityLinks
,
{
alias
:
linkName
}).
entity
;
newEntity
=
_
.
findWhere
(
links
[
entity
],
{
alias
:
linkName
}).
entity
;
return
get
(
newEntity
,
fieldNames
);
}
}
...
...
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