feat : add project code and task auto-numbering

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-03-13 08:20:31 +01:00
parent 56275a9ebe
commit 517511177c
5 changed files with 98 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Repository;
use App\Entity\Project;
use App\Entity\Task;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
@@ -14,4 +15,17 @@ class TaskRepository extends ServiceEntityRepository
{
parent::__construct($registry, Task::class);
}
public function findMaxNumberByProject(Project $project): int
{
$result = $this->createQueryBuilder('t')
->select('MAX(t.number)')
->where('t.project = :project')
->setParameter('project', $project)
->getQuery()
->getSingleScalarResult()
;
return (int) ($result ?? 0);
}
}