Hello Yuri,
you have deprecate https://github.com/espocrm/espocrm/c...c58ff986f63005
But in my 2 cents, we need getPDO
my sample is :
- patient : more than 12000 record
- care : more than 7610578 record
I know, i the past, i try use orm with result : long time result or no result (database go away).
Please, dont deprecate PDO
Kind Regards
]
you have deprecate https://github.com/espocrm/espocrm/c...c58ff986f63005
But in my 2 cents, we need getPDO
my sample is :
- patient : more than 12000 record
- care : more than 7610578 record
I know, i the past, i try use orm with result : long time result or no result (database go away).
Please, dont deprecate PDO
Kind Regards
PHP Code:
$pdo = $this->getEntityManager()->getPDO();
$entityManager = $this->getEntityManager();
$patientList = $entityManager->getRepository('Patient')->where([
'deleted' => 0
])->find();
foreach ($patientList as $patient) {
$sql = "SELECT MAX(DATE(date_time)) as dateLastCare, MIN(DATE(date_time)) as dateFirstCare FROM care WHERE national_number='" .$patient->get('nationalNumber') ."' AND deleted='0' GROUP BY national_number;";
$sth = $pdo->prepare($sql);
$sth->execute();
$row = $sth->fetch();
if ($row){
$patient->set('dateLastCare', $row['dateLastCare']);
$patient->set('dateFirstCare', $row['dateFirstCare']);
$entityManager->saveEntity($patient, ['skipAll' => true]);
}
}
Comment