PHP Code:
<?php
include 'path/to/espo/bootstrap.php';
$app = new \Espo\Core\Application();
$app->setupSystemUser();
/** @var \Espo\ORM\EntityManager $em */
$em = $app->getContainer()->get('entityManager');
$notes = $em
->getRDBRepository('Note')
->sth()
->order('createdAt')
->find();
$number = 0;
foreach ($notes as $note) {
$note->set('numberAux', $number);
$em->saveEntity($note);
$number++;
}
The problem of this solution that will lose the current order of notes.
Leave a comment: