我正在Symfony中构建一个Web应用程序,我需要访问控制器中某个实体的一些属性,以便将这些值添加到$candidature实体中。谢谢您的帮助。
控制器. php:
class CandidatureController extends AbstractController
{
#[Route('/candidature', name: 'app_candidature')]
public function index(EntityManagerInterface $entityManager): Response
{
$candidature = new Candidature();
//$candidatNom = $entityManager->getRepository(ProfileCandidat::class)->findBy($Nom);
$candidature->setNom($candidatNom);
$candidature->setPrenom('Charles');
$candidature->setCv('cv');
$candidature->setPostId('4');
$entityManager->persist($candidature);
$entityManager->flush();
return $this->render('candidature/index.html.twig', [
'controller_name' => 'CandidatureController',
]);
}
}
1条答案
按热度按时间djmepvbi1#
应该可以