[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)) {
|
if (\is_null($scoped)) {
|
||||||
return Cache::get(
|
return Cache::get(
|
||||||
"othertags-{$this->getId()}",
|
"othertags-{$this->getId()}",
|
||||||
fn () => (($t = DB::dql(
|
fn () => F\partition(
|
||||||
|
DB::dql(
|
||||||
<<< 'EOQ'
|
<<< 'EOQ'
|
||||||
SELECT circle, tag
|
SELECT circle, tag
|
||||||
FROM actor_tag tag
|
FROM actor_tag tag
|
||||||
@ -304,19 +305,21 @@ class Actor extends Entity
|
|||||||
EOQ,
|
EOQ,
|
||||||
['id' => $this->getId()],
|
['id' => $this->getId()],
|
||||||
options: ['offset' => $offset, 'limit' => $limit],
|
options: ['offset' => $offset, 'limit' => $limit],
|
||||||
)) === [] ? [[],[]] : $t),
|
),
|
||||||
|
fn ($o) => $o instanceof ActorCircle,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$scoped_id = \is_int($scoped) ? $scoped : $scoped->getId();
|
$scoped_id = \is_int($scoped) ? $scoped : $scoped->getId();
|
||||||
return Cache::get(
|
return Cache::get(
|
||||||
"othertags-{$this->getId()}-by-{$scoped_id}",
|
"othertags-{$this->getId()}-by-{$scoped_id}",
|
||||||
fn () => (($t = DB::dql(
|
fn () => F\partition(
|
||||||
|
DB::dql(
|
||||||
<<< 'EOQ'
|
<<< 'EOQ'
|
||||||
SELECT circle, tag
|
SELECT circle, tag
|
||||||
FROM actor_tag tag
|
FROM actor_tag tag
|
||||||
JOIN actor_circle circle
|
JOIN actor_circle circle
|
||||||
WITH
|
WITH tag.tagger = circle.tagger
|
||||||
tag.tagger = circle.tagger
|
|
||||||
AND tag.tag = circle.tag
|
AND tag.tag = circle.tag
|
||||||
WHERE
|
WHERE
|
||||||
tag.tagged = :id
|
tag.tagged = :id
|
||||||
@ -329,7 +332,9 @@ class Actor extends Entity
|
|||||||
EOQ,
|
EOQ,
|
||||||
['id' => $this->getId(), 'scoped' => $scoped_id],
|
['id' => $this->getId(), 'scoped' => $scoped_id],
|
||||||
options: ['offset' => $offset, 'limit' => $limit],
|
options: ['offset' => $offset, 'limit' => $limit],
|
||||||
)) === [] ? [[],[]] : $t),
|
),
|
||||||
|
fn ($o) => $o instanceof ActorCircle,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user