feat(subscription): implement resource quota management based on subscription plans
This commit is contained in:
@@ -64,6 +64,24 @@ class ClinicResourceRepository extends ServiceEntityRepository
|
||||
return $qb->orderBy('r.name', 'ASC')->getQuery()->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* همهٔ منابع یک محیط، فعال و غیرفعال — مبنای سقفِ پلن اشتراک.
|
||||
*
|
||||
* غیرفعالها هم شمرده میشوند وگرنه سقف با یک بار غیرفعالکردن دور زده میشد؛
|
||||
* منابعِ پلِ پزشک/پرسنل هم شمرده میشوند، چون از نظر محصول «منبع» همانقدر منبعاند.
|
||||
*/
|
||||
public function countForPair(string $entityType, int $entityId): int
|
||||
{
|
||||
return (int) $this->createQueryBuilder('r')
|
||||
->select('COUNT(r.id)')
|
||||
->where('r.entityType = :type')
|
||||
->andWhere('r.entityId = :id')
|
||||
->setParameter('type', $entityType)
|
||||
->setParameter('id', $entityId)
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
}
|
||||
|
||||
/** منابع فعال یک محیط — شرط آمادگیِ حالت نوبتدهی منبعمحور. */
|
||||
public function countActiveForPair(string $entityType, int $entityId): int
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user