entityManager->getRepository(self::ENTITY)->findBy([], [ 'productLine' => 'ASC', 'model' => 'ASC', ]); $amd = array_filter($items, static fn (Cpu $cpu) => $cpu->getBrand()->getName() === 'AMD' && $cpu->isReceived()); $intel = array_filter($items, static fn (Cpu $cpu) => $cpu->getBrand()->getName() === 'Intel' && $cpu->isReceived()); $others = array_filter($items, static fn (Cpu $cpu) => ( ! in_array($cpu->getBrand()->getName(), ['AMD', 'Intel'], TRUE)) && $cpu->isReceived()); $notReceived = array_filter($items, static fn (CPU $cpu) => $cpu->isReceived() === FALSE); return $this->render($template, [ 'all' => [ 'not_acquired' => $notReceived, 'amd' => $amd, 'intel' => $intel, 'others' => $others, ], ]); } #[Route('/new', name: 'cpu_new', methods: ['GET', 'POST'])] public function new(Request $request): Response { return $this->itemCreate($request, 'cpu'); } #[Route('/{id}', name: 'cpu_show', methods: ['GET'])] public function show(Cpu $cpu): Response { return $this->itemView($cpu, 'cpu'); } #[Route('/{id}/edit', name: 'cpu_edit', methods: ['GET', 'POST'])] public function edit(Request $request, Cpu $cpu): Response { return $this->itemUpdate($request, $cpu, 'cpu'); } #[Route('/{id}', name: 'cpu_delete', methods: ['POST'])] public function delete(Request $request, Cpu $cpu): Response { return $this->deleteCSRF($request, $cpu); } }