feat : add project code and task auto-numbering
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user