getEntityManager()->getConnection(); if ($connection instanceof PrimaryReadReplicaConnection) { if ( !$limiter || !($limiter->getContactId() || $limiter->getContactIdList()) ) { $connection->ensureConnectedToReplica(); } } return $connection; } }