Newer
Older
use App\Action\Functions;
use App\Validation\ArrayValidation;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class HomeController extends AbstractController
{
#[Route('/', name: 'home', methods: ['POST'])]
public function home(Request $request): Response
{
$array = $request->get('arr');
$errors = ArrayValidation::validate($array);
if (count($errors) > 0) {
return new Response((string)$errors);
}
$result = $this->functions->prepareMenu($array);
return $this->json($result);