<?php
namespace App\Controller;
use App\Entity\Image;
use App\Entity\Processing;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Doctrine\ORM\EntityManagerInterface;
class BackendController extends AbstractController
{
public function index(EntityManagerInterface $entityManager, $id = false): Response
{
$parameters = [];
//if called by permalink
if ($id) {
// get the processing of given image
$image = $entityManager->getRepository(Image::class)->findById($id);
$processing = $image->getProcessing()->first()->getType();
//set permalink for template
$permalink = ['id' => $id,'processing' => $processing];
}
if (isset($permalink)) {
$parameters['permalink'] = $permalink;
}
return $this->render('backend/index.html.twig',$parameters);
}
}