TaskSchema module
This commit is contained in:
36
backend/src/Repository/TaskSchemaRepository.php
Normal file
36
backend/src/Repository/TaskSchemaRepository.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Collection\TaskSchemaCollection;
|
||||
use App\Entity\TaskSchema;
|
||||
use App\Enum\TaskSchemaStatus;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<TaskSchema>
|
||||
*/
|
||||
class TaskSchemaRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, TaskSchema::class);
|
||||
}
|
||||
|
||||
public function allSchemas(): TaskSchemaCollection
|
||||
{
|
||||
return new TaskSchemaCollection(parent::findAll());
|
||||
}
|
||||
|
||||
/** @return list<TaskSchema> */
|
||||
public function findActiveWithRepeat(): array
|
||||
{
|
||||
return $this->createQueryBuilder('s')
|
||||
->andWhere('s.status = :status')
|
||||
->andWhere('s.repeat IS NOT NULL')
|
||||
->setParameter('status', TaskSchemaStatus::Active)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user