Skip to content

Commit d652756

Browse files
committed
- param $fid following previous commit 77e25ff @ App\Repository\Post\Content\PostContentRepository::getPostsContent()
- var `$fid` as all its usages get removed @ `App\PostsQuery\PostsTree::fillWithParentPost()` @ be
1 parent 77e25ff commit d652756

4 files changed

Lines changed: 9 additions & 10 deletions

File tree

be/src/PostsQuery/PostsTree.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public function __construct(
4545
*/
4646
public function fillWithParentPost(QueryResult $result): array
4747
{
48-
$fid = $result->fid;
4948
/** @var Collection<int> $tids */
5049
$tids = $result->threads->map(fn(ThreadKey $postKey) => $postKey->postId);
5150
/** @var Collection<int> $pids */
@@ -83,12 +82,12 @@ public function fillWithParentPost(QueryResult $result): array
8382

8483
$this->stopwatch->start('parsePostContentProtoBufBytes');
8584
// not using one-to-one association due to relying on PostRepository->getTableNameSuffix()
86-
$replyContents = collect($this->replyContentRepository->getPostsContent($fid, $allRepliesId))
85+
$replyContents = collect($this->replyContentRepository->getPostsContent($allRepliesId))
8786
->mapWithKeys(fn(ReplyContent $content) => [$content->getPid() => $content->getContent()]);
8887
$this->replies->each(fn(Reply $reply) =>
8988
$reply->setContent($replyContents->get($reply->getPid())));
9089

91-
$subReplyContents = collect($this->subReplyContentRepository->getPostsContent($fid, $spids))
90+
$subReplyContents = collect($this->subReplyContentRepository->getPostsContent($spids))
9291
->mapWithKeys(fn(SubReplyContent $content) => [$content->getSpid() => $content->getContent()]);
9392
$this->subReplies->each(fn(SubReply $subReply) =>
9493
$subReply->setContent($subReplyContents->get($subReply->getSpid())));

be/src/Repository/Post/Content/PostContentRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
*/
1212
abstract class PostContentRepository extends BaseRepository
1313
{
14-
abstract public function getPostsContent(int $fid, array|\ArrayAccess $postsId): array;
14+
abstract public function getPostsContent(array|\ArrayAccess $postsId): array;
1515
}

be/src/Repository/Post/Content/ReplyContentRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ public function __construct(ManagerRegistry $registry)
1313
parent::__construct($registry, ReplyContent::class);
1414
}
1515

16-
public function getPostsContent(int $fid, array|\ArrayAccess $postsId): array
16+
public function getPostsContent(array|\ArrayAccess $postsId): array
1717
{
18-
$dql = 'SELECT t FROM App\Entity\Post\Content\ReplyContent t WHERE t.fid = :fid AND t.pid IN (:pid)';
19-
return $this->getQueryResultWithParams($dql, ['fid' => $fid, 'pid' => $postsId]);
18+
$dql = 'SELECT t FROM App\Entity\Post\Content\ReplyContent t WHERE t.pid IN (:pid)';
19+
return $this->getQueryResultWithParams($dql, ['pid' => $postsId]);
2020
}
2121
}

be/src/Repository/Post/Content/SubReplyContentRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ public function __construct(ManagerRegistry $registry)
1414
parent::__construct($registry, SubReplyContent::class);
1515
}
1616

17-
public function getPostsContent(int $fid, array|\ArrayAccess $postsId): array
17+
public function getPostsContent(array|\ArrayAccess $postsId): array
1818
{
19-
$dql = 'SELECT t FROM App\Entity\Post\Content\SubReplyContent t WHERE t.fid = :fid AND t.spid IN (:spid)';
20-
return $this->getQueryResultWithParams($dql, ['fid' => $fid, 'spid' => $postsId]);
19+
$dql = 'SELECT t FROM App\Entity\Post\Content\SubReplyContent t WHERE t.spid IN (:spid)';
20+
return $this->getQueryResultWithParams($dql, ['spid' => $postsId]);
2121
}
2222
}

0 commit comments

Comments
 (0)