mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-01 12:33:49 +00:00
send first calendar on ms graph
This commit is contained in:
@@ -12,52 +12,68 @@ declare(strict_types=1);
|
||||
namespace Chill\CalendarBundle\Repository;
|
||||
|
||||
use Chill\CalendarBundle\Entity\Calendar;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
/**
|
||||
* @method Calendar|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Calendar|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Calendar[] findAll()
|
||||
* @method Calendar[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class CalendarRepository extends ServiceEntityRepository
|
||||
class CalendarRepository implements ObjectRepository
|
||||
{
|
||||
// private EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
parent::__construct($registry, Calendar::class);
|
||||
// $this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class);
|
||||
$this->repository = $entityManager->getRepository(Calendar::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Calendar[] Returns an array of Calendar objects
|
||||
// */
|
||||
/*
|
||||
public function findByExampleField($value)
|
||||
public function countByAccompanyingPeriod(AccompanyingPeriod $period): int
|
||||
{
|
||||
return $this->createQueryBuilder('c')
|
||||
->andWhere('c.exampleField = :val')
|
||||
->setParameter('val', $value)
|
||||
->orderBy('c.id', 'ASC')
|
||||
->setMaxResults(10)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
return $this->repository->count(['accompanyingPeriod' => $period]);
|
||||
}
|
||||
|
||||
public function find($id): ?Calendar
|
||||
{
|
||||
return $this->repository->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|Calendar[]
|
||||
*/
|
||||
|
||||
/*
|
||||
public function findOneBySomeField($value): ?Calendar
|
||||
public function findAll(): array
|
||||
{
|
||||
return $this->createQueryBuilder('c')
|
||||
->andWhere('c.exampleField = :val')
|
||||
->setParameter('val', $value)
|
||||
->getQuery()
|
||||
->getOneOrNullResult()
|
||||
;
|
||||
return $this->repository->findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|Calendar[]
|
||||
*/
|
||||
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
|
||||
{
|
||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|Calendar[]
|
||||
*/
|
||||
public function findByAccompanyingPeriod(AccompanyingPeriod $period, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
|
||||
{
|
||||
return $this->findBy(
|
||||
[
|
||||
'accompanyingPeriod' => $period,
|
||||
],
|
||||
$orderBy,
|
||||
$limit,
|
||||
$orderBy
|
||||
);
|
||||
}
|
||||
|
||||
public function findOneBy(array $criteria): ?Calendar
|
||||
{
|
||||
return $this->repository->findOneBy($criteria);
|
||||
}
|
||||
|
||||
public function getClassName()
|
||||
{
|
||||
return Calendar::class;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user