feat: add SeedDemoDataCommand for seeding production-like demo data for testing representations, doctors, clinics, users, appointments, and commissions

This commit is contained in:
hamed
2026-07-09 08:07:41 +03:30
parent 0750bc9812
commit 0ad8487aac
16 changed files with 3454 additions and 1155 deletions
@@ -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);