Hey guys.
I have to recalculate a formula in about 500k records.
Is there a way to do it via terminal?
I have to recalculate a formula in about 500k records.
Is there a way to do it via terminal?
<?php
include "bootstrap.php";
use Espo\Core\Application;
$container = (new Application())->getContainer();
$entityManager = $container->get('entityManager');
$collection = $entityManager
->getRepository('NameOfYourEntityType')
->where(['someField' => 'someValue']) // where clause if needed, omit to fetch all records
->sth() // makes memory consuming much less
->find();
foreach ($collection as $entity) {
$entityManager->saveEntity($entity); // saving will re-calculate formula
}
Comment