Professional Documents
Culture Documents
Documentation Symfony
Documentation Symfony
return $this->render('@Athlete/Default/ajoutahlete.html.twig',array('f'=>$form-
>createView()));
}
$Form=$this->createFormBuilder($athlete)
->add('cin')
->add('Rechercher',SubmitType::class)
->getForm();
$Form->handleRequest($request);
if($Form->isSubmitted()){
$athlete=$this->getDoctrine()
->getRepository(Athlete::class)
->findBy(array('cin'=>$athlete->getCin()));
}
else{
$athlete=$this->getDoctrine()
->getRepository(Athlete::class)
->findAll();
}
return $this->render('@Athlete/Default/Recherche.html.twig',
array('f'=>$Form->createView(),'athlete'=>$athlete ));
PS: fel method hethi makhdouma ken fel input 7at cin y affichi l cin sinon y affichi ness l kol
UPDATE
public function UpdateAction(Request $request, $cin){
$em=$this->getDoctrine()->getManager();
$athlete=$this->getDoctrine()
->getRepository(Athlete::class)
->find($cin);
$Form=$this->createForm(AthleteTestType::class,$athlete);
$Form->handleRequest($request);
if($Form->isSubmitted() ){
$em->flush();
return $this->redirectToRoute('calcul');
}
return $this->render('@Athlete/Default/update.html.twig',
array('f'=>$Form->createView()));
}
exemple ta3 methode moghta -_-
hné ken taux > 1 yaamel update lel etat l
1
public function testAction(Request $request, $cin){
$em=$this->getDoctrine()->getManager();
$athlete=$this->getDoctrine()
->getRepository(Athlete::class)
->find($cin);
$Form=$this->createForm(AthleteTestType::class,$athlete);
$Form->handleRequest($request);
if($Form->isSubmitted() ){
if(($athlete->getTauxD()>1) && ($athlete->getTestDopage()-
>getCodeTest()==1)){
$athlete->setEtat(1);
}
$em->flush();
return $this->redirectToRoute('calcul');
}
return $this->render('@Athlete/Default/test.html.twig',
array('f'=>$Form->createView(),'athlete'=>$athlete));
}
ya3ni ken nombre de points mta3 sujet <= score mta3 candidat w ken description mta3 sujet
mawjouda ka mot clé aand l candidat n’affichi sujet
public function simulationAction($cin){
$em=$this->getDoctrine()->getManager();
$condidat=$this->getDoctrine()
->getRepository(Condidat::class)
->find($cin);
$sujets=$this->getDoctrine()->getRepository(Sujet::class)->findAll();
return $this->render('@These/These/simulation.html.twig',
array('condidat'=>$condidat,'sujets'=>$sujets));
}
<ul>
{% for s in sujets %}
{% if s.nbpoints <= condidat.score and
condidat.motcle in s.description %}
<li class="ref">{{ s.reference}} {{ s.titre }} </li>
{% endif %}
{% endfor %}
</ul>
<button id="cl">Associer un sujet</button>
{% set i=0 %}
{% for a in athletes %}
{% if a.etat ==1 %}
{% set i=i+1 %}
{% endif %}
{% endfor %}
IMPORTANT
KEN tlazzit bech taamel formtype ekher aala
nafs l Entity aamel new php class fel
FormType folder w mbaad aamel copier
coller lel method elli fi west el FormType
original mte3ek