feat: implement staff management and subscription system

- Added StaffController for managing clinic staff, including listing, creating, updating, and toggling staff status.
- Created ClinicStaff entity and repository for staff data handling.
- Developed SubscriptionController to manage subscription plans and periods, including trial subscriptions.
- Introduced SubscriptionPlan, SubscriptionPeriod, and ClinicSubscription entities for subscription management.
- Implemented SubscriptionService for handling subscription logic, including trial activation and subscription creation from payments.
- Added necessary repositories for subscription entities to facilitate data access and manipulation.
This commit is contained in:
hamed
2026-06-14 22:10:28 +03:30
parent dcd631f503
commit b0244f28f5
53 changed files with 4434 additions and 40 deletions
@@ -0,0 +1,42 @@
<?php
namespace App\Staff\Repository;
use App\Staff\Entity\ClinicStaff;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
class ClinicStaffRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ClinicStaff::class);
}
public function findByUuid(string $uuid): ?ClinicStaff
{
return $this->findOneBy(['uuid' => $uuid]);
}
public function findByEntity(string $entityType, int $entityId, bool $activeOnly = false): array
{
$qb = $this->createQueryBuilder('s')
->where('s.entityType = :type')
->andWhere('s.entityId = :id')
->setParameter('type', $entityType)
->setParameter('id', $entityId)
->orderBy('s.fullName', 'ASC');
if ($activeOnly) {
$qb->andWhere('s.active = true');
}
return $qb->getQuery()->getResult();
}
public function save(ClinicStaff $staff): void
{
$this->getEntityManager()->persist($staff);
$this->getEntityManager()->flush();
}
}