<?php

declare(strict_types=1);

namespace App\Repository;

use App\Entity\TaskBookStackLink;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

class TaskBookStackLinkRepository extends ServiceEntityRepository
{
    public function __construct(ManagerRegistry $registry)
    {
        parent::__construct($registry, TaskBookStackLink::class);
    }

    /** @return TaskBookStackLink[] */
    public function findByTaskId(int $taskId): array
    {
        return $this->findBy(['task' => $taskId], ['createdAt' => 'DESC']);
    }
}
