0
respostas

thrown in C:\Users\Cursos Alura\Documents\Curso PHP\Web\aula2\src\Entity\Curso.php on line 37

<?php

namespace Alura\Cursos\Controller;

use Alura\Cursos\Entity\Curso; use Alura\Cursos\Infra\EntityManagerCreator;

class Persistencia implements InterfaceControladorRequisicao { /**

 * @var \Doctrine\ORM\EntityManagerInterface
 */
private $entityManager;

public function __construct()
{
    $this->entityManager = (new EntityManagerCreator())->getEntityManager();
}

public function processaRequisicao(): void
{
    $curso = new Curso();
    $curso->setDescricao($_POST['descricao']);
    $this->entityManager->persist($curso);
    $this->entityManager->flush();
}

}