migrate notes

This commit is contained in:
2025-05-21 07:29:45 +01:00
parent 6a087aae48
commit 1538fc7904
11 changed files with 788 additions and 31 deletions

View File

@@ -29,7 +29,7 @@ class GuiController extends AbstractController {
public function notes(
EntityManagerInterface $entityManager,
): array {
$notes = $entityManager->getRepository(Note::class)->findAll();
$notes = $entityManager->getRepository(Note::class)->findAllOrderedBySlugDesc();
return [
'title' => 'Joe Carstairs\' notes',

View File

@@ -30,28 +30,14 @@ class NoteRepository extends ServiceEntityRepository
return count($wherePublishedOnDate);
}
// /**
// * @return Note[] Returns an array of Note objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('n')
// ->andWhere('n.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('n.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Note
// {
// return $this->createQueryBuilder('n')
// ->andWhere('n.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
/**
* @return Note[] Returns an array of Note objects
*/
public function findAllOrderedBySlugDesc(): array
{
return $this->createQueryBuilder('n')
->orderBy('n.slug', 'DESC')
->getQuery()
->getResult();
}
}