getEntityManager()->persist($e); if ($flush) { $this->getEntityManager()->flush(); } } /** تاریخچه‌ی یک مراجعه (جدید → قدیم)، آرایه‌ای. */ public function findBySessionUuid(string $sessionUuid): array { return $this->createQueryBuilder('l') ->select('l.field AS field', 'l.operation AS operation', 'l.oldValue AS old_value', 'l.newValue AS new_value', 'l.actorName AS actor_name', 'l.note AS note', 'l.createdAt AS created_at') ->join('l.session', 's') ->where('s.uuid = :uuid')->setParameter('uuid', $sessionUuid) ->orderBy('l.createdAt', 'DESC')->addOrderBy('l.id', 'DESC') ->getQuery()->getArrayResult(); } }