[ENTITY][Actor] Partition the results of the joint query into a separate list of ActorsCircles and ActorTags, as desired
This commit is contained in:
parent
a3e5f7646c
commit
6c7f69dd94
@ -292,7 +292,8 @@ class Actor extends Entity
|
||||
if (\is_null($scoped)) {
|
||||
return Cache::get(
|
||||
"othertags-{$this->getId()}",
|
||||
fn () => (($t = DB::dql(
|
||||
fn () => F\partition(
|
||||
DB::dql(
|
||||
<<< 'EOQ'
|
||||
SELECT circle, tag
|
||||
FROM actor_tag tag
|
||||
@ -304,19 +305,21 @@ class Actor extends Entity
|
||||
EOQ,
|
||||
['id' => $this->getId()],
|
||||
options: ['offset' => $offset, 'limit' => $limit],
|
||||
)) === [] ? [[],[]] : $t),
|
||||
),
|
||||
fn ($o) => $o instanceof ActorCircle,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
$scoped_id = \is_int($scoped) ? $scoped : $scoped->getId();
|
||||
return Cache::get(
|
||||
"othertags-{$this->getId()}-by-{$scoped_id}",
|
||||
fn () => (($t = DB::dql(
|
||||
fn () => F\partition(
|
||||
DB::dql(
|
||||
<<< 'EOQ'
|
||||
SELECT circle, tag
|
||||
FROM actor_tag tag
|
||||
JOIN actor_circle circle
|
||||
WITH
|
||||
tag.tagger = circle.tagger
|
||||
WITH tag.tagger = circle.tagger
|
||||
AND tag.tag = circle.tag
|
||||
WHERE
|
||||
tag.tagged = :id
|
||||
@ -329,7 +332,9 @@ class Actor extends Entity
|
||||
EOQ,
|
||||
['id' => $this->getId(), 'scoped' => $scoped_id],
|
||||
options: ['offset' => $offset, 'limit' => $limit],
|
||||
)) === [] ? [[],[]] : $t),
|
||||
),
|
||||
fn ($o) => $o instanceof ActorCircle,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user