feat: add insurance and location management
- Introduced InsuranceType enum for insurance categorization. - Created InsuranceRepository for managing insurance entities. - Developed LocationController for handling provinces and cities, including CRUD operations. - Implemented City and Province entities with necessary fields and relationships. - Added CityRepository and ProvinceRepository for database interactions. - Established Specialty management with SpecialtyController, including CRUD operations. - Created Specialty and Tag entities with appropriate fields and relationships. - Implemented TagController for managing tags, including CRUD operations. - Added TagRepository for database interactions with tags.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\DoctorService\Repository;
|
||||
|
||||
use App\DoctorService\Entity\DoctorService;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class DoctorServiceRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, DoctorService::class);
|
||||
}
|
||||
|
||||
/** @return DoctorService[] */
|
||||
public function findActive(?int $specialtyId = null): array
|
||||
{
|
||||
$qb = $this->createQueryBuilder('ds')
|
||||
->where('ds.status = 1')
|
||||
->orderBy('ds.weight', 'ASC')
|
||||
->addOrderBy('ds.name', 'ASC');
|
||||
|
||||
if ($specialtyId !== null) {
|
||||
$qb->andWhere('ds.specialty = :specialty')->setParameter('specialty', $specialtyId);
|
||||
}
|
||||
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
|
||||
public function save(DoctorService $service, bool $flush = true): void
|
||||
{
|
||||
$this->getEntityManager()->persist($service);
|
||||
if ($flush) $this->getEntityManager()->flush();
|
||||
}
|
||||
|
||||
public function remove(DoctorService $service, bool $flush = true): void
|
||||
{
|
||||
$this->getEntityManager()->remove($service);
|
||||
if ($flush) $this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user