feat: add SeedDemoDataCommand for seeding production-like demo data for testing representations, doctors, clinics, users, appointments, and commissions
This commit is contained in:
@@ -29,6 +29,29 @@ class RepresentationRepository extends ServiceEntityRepository
|
||||
return $this->findOneBy(['domain' => $domain, 'active' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* تطبیق بر اساس اولین label دامنه (TLD-agnostic) — همراستا با تطبیق subdomainِ
|
||||
* شهرها؛ لازم برای dev (مثلاً host=`x-nobat.localhost` باید نمایندهی `x-nobat.ir`
|
||||
* را پیدا کند). فقط وقتی نتیجه یکتاست برمیگرداند تا از ابهام (چند TLD روی یک
|
||||
* prefix) جلوگیری شود.
|
||||
*/
|
||||
public function findActiveByDomainPrefix(string $prefix): ?Representation
|
||||
{
|
||||
if ($prefix === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$rows = $this->createQueryBuilder('r')
|
||||
->where('r.active = true')
|
||||
->andWhere('r.domain LIKE :p')
|
||||
->setParameter('p', $prefix . '.%')
|
||||
->setMaxResults(2)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
|
||||
return count($rows) === 1 ? $rows[0] : null;
|
||||
}
|
||||
|
||||
public function save(Representation $entity, bool $flush = true): void
|
||||
{
|
||||
$this->getEntityManager()->persist($entity);
|
||||
|
||||
Reference in New Issue
Block a user