Erreur de type "An exception occurred while executing"
Bonjour tout le monde depuis un certain Temp je me retrouve bloquer sur un passage de mon application. le projet consiste à envoyer des informations des informations sur une période a l'agence principal sur une période donnée cependant j'parviens à créer la période et même a partir d'un twig faire une liste des consentement sur une période donnée sauf que quand j'aimerai editer un consentement pour a période pour avoir la liste des consentement de la période j'ai cette erreur
Code:
An exception occurred while executing 'SELECT t0.id AS id1, t0.nclient AS nclient2, t0.nbfor AS nbfor3, t0.ncr AS ncr4, t0.nlcpm AS nlcpm5, t0.agences_id AS agences_id6, t0.agent_id AS agent_id7, t0.periode_id AS periode_id8 FROM Consentement t0 WHERE t0.id IN (?) LIMIT 1' with params [[]]:
Quelqu'un pourrra me guidé s'il vous plait ?
Voici les entités pour le consentement et la période
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
| <?php
namespace Projet\ConsentementBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
*/
class Consentement
{
/**
* @ORM\GeneratedValue
* @ORM\Id
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="integer")
* @Assert\NotBlank()
*/
private $nclient;
/**
* @ORM\Column(type="integer")
* @Assert\NotBlank()
*/
private $nbfor;
/**
* @ORM\Column(type="integer")
* @Assert\NotBlank()
*/
private $ncr;
/**
* @ORM\Column(type="integer")
* @Assert\NotBlank()
*/
private $nlcpm;
/**
* @ORM\ManyToOne(targetEntity="Agences")
* @Assert\NotBlank()
*/
private $agences;
/**
* @ORM\ManyToOne(targetEntity="Agent")
* @Assert\NotBlank()
*/
private $agent;
/**
*@ORM\ManyToOne(targetEntity="Periode")
*/
public $periode;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set nclient
*
* @param integer $nclient
* @return Consentement
*/
public function setNclient($nclient)
{
$this->nclient = $nclient;
return $this;
}
/**
* Get nclient
*
* @return integer
*/
public function getNclient()
{
return $this->nclient;
}
/**
* Set nbfor
*
* @param integer $nbfor
* @return Consentement
*/
public function setNbfor($nbfor)
{
$this->nbfor = $nbfor;
return $this;
}
/**
* Get nbfor
*
* @return integer
*/
public function getNbfor()
{
return $this->nbfor;
}
/**
* Set ncr
*
* @param integer $ncr
* @return Consentement
*/
public function setNcr($ncr)
{
$this->ncr = $ncr;
return $this;
}
/**
* Get ncr
*
* @return integer
*/
public function getNcr()
{
return $this->ncr;
}
/**
* Set nlcpm
*
* @param integer $nlcpm
* @return Consentement
*/
public function setNlcpm($nlcpm)
{
$this->nlcpm = $nlcpm;
return $this;
}
/**
* Get nlcpm
*
* @return integer
*/
public function getNlcpm()
{
return $this->nlcpm;
}
/**
* Set agences
*
* @param \Projet\ConsentementBundle\Entity\Agences $agences
* @return Consentement
*/
public function setAgences(\Projet\ConsentementBundle\Entity\Agences $agences = null)
{
$this->agences = $agences;
return $this;
}
/**
* Get agences
*
* @return \Projet\ConsentementBundle\Entity\Agences
*/
public function getAgences()
{
return $this->agences;
}
/**
* Set agent
*
* @param \Projet\ConsentementBundle\Entity\Agent $agent
* @return Consentement
*/
public function setAgent(\Projet\ConsentementBundle\Entity\Agent $agent = null)
{
$this->agent = $agent;
return $this;
}
/**
* Get agent
*
* @return \Projet\ConsentementBundle\Entity\Agent
*/
public function getAgent()
{
return $this->agent;
}
/**
* @return float
*/
public function tdc()
{
return ($this->nbfor / $this->nclient)*100;
}
/**
* @return float
*/
public function trc()
{
return ($this->ncr / $this->nclient)*100;
}
/**
* Set periode
*
* @param \Projet\ConsentementBundle\Entity\Periode $periode
* @return Consentement
*/
public function setPeriode(\Projet\ConsentementBundle\Entity\Periode $periode = null)
{
$this->periode = $periode;
return $this;
}
/**
* Get periode
*
* @return \Projet\ConsentementBundle\Entity\Periode
*/
public function getPeriode()
{
return $this->periode;
}
} |
pour la periode
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
<?php
namespace Projet\ConsentementBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\EntityRepository;
/**
* @ORM\Entity
*/
class Periode
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="date")
*/
protected $date;
/**
* @ORM\Column(type="string", length=250)
*/
protected $nom;
/**
* @ORM\OneToMany(targetEntity="Consentement", mappedBy="programme")
*/
public $consentement;
/**
* Constructor
*/
public function __construct()
{
$this->consentement = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set date
*
* @param \DateTime $date
* @return Periode
*/
public function setDate($date)
{
$this->date = $date;
return $this;
}
/**
* Get date
*
* @return \DateTime
*/
public function getDate()
{
return $this->date;
}
/**
* Set nom
*
* @param string $nom
* @return Periode
*/
public function setNom($nom)
{
$this->nom = $nom;
return $this;
}
/**
* Get nom
*
* @return string
*/
public function getNom()
{
return $this->nom;
}
/**
* Add consentement
*
* @param \Projet\ConsentementBundle\Entity\Intervention $consentement
* @return Periode
*/
public function addConsentement(\Projet\ConsentementBundle\Entity\Intervention $consentement)
{
$this->consentement[] = $consentement;
return $this;
}
/**
* Remove consentement
*
* @param \Projet\ConsentementBundle\Entity\Intervention $consentement
*/
public function removeConsentement(\Projet\ConsentementBundle\Entity\Intervention $consentement)
{
$this->consentement->removeElement($consentement);
}
/**
* Get consentement
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getConsentement()
{
return $this->consentement;
}
} |
les controllers
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
<?php
namespace Projet\ConsentementBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Projet\ConsentementBundle\Entity\Periode;
use Projet\ConsentementBundle\Entity\Consentement;
use Projet\ConsentementBundle\Form\ConsentementForm;
use Projet\ConsentementBundle\Form\PeriodeForm;
use Projet\ConsentementBundle\Form\ConsentementRechercheForm;
use Projet\ConsentementBundle\Form\ConsentementChoiceForm;
class PeriodeConsentementController extends ContainerAware
{
public function listerAction($periode)
{
$em = $this->container->get('doctrine')->getEntityManager();
$consentement= $em->getRepository('ProjetConsentementBundle:Consentement')->findByPeriode($periode);
$form = $this->container->get('form.factory')->create(new ConsentementRechercheForm());
$choiceform = $this->container->get('form.factory')->create(new ConsentementChoiceForm());
$periode= $em->getRepository('ProjetConsentementBundle:Periode')->find($periode);
return $this->container->get('templating')->renderResponse('ProjetConsentementBundle:Consentement:listerPeriodeConsentement.html.twig',
array('consentement' => $consentement,'periode'=>$periode,'form'=>$form->createView(),
'choiceform'=>$choiceform->createView()));
}
public function editerPeriodeConsentementAction($periode,$consentement=null)
{
$choiceform = $this->container->get('form.factory')->create(new ConsentementChoiceForm());
$options = $choiceform->get('id')->getConfig()->getOptions();
$choices = $options['choice_list']->getChoices();
$em = $this->container->get('doctrine')->getEntityManager();
$periode= $em->getRepository('ProjetConsentementBundle:Periode')->find($periode);
$consentement=$em->getRepository('ProjetConsentementBundle:Consentement')->findByPeriode($periode);
// traitement d'enregistrement des consentement
if(isset($consentement))
{
$consentement=$em->getRepository('ProjetConsentementBundle:Consentement')->findOneById($consentement);
}
else
$consentement = new Consentement();$consentement->setPeriode($periode);
$formP = $this->container->get('form.factory')->create(new PeriodeForm(),$periode);
$choiceform = $this->container->get('form.factory')->create(new ConsentementChoiceForm());
$formI = $this->container->get('form.factory')->create(new ConsentementForm(),$consentement);
$request= $this->container->get('request');
if ($request->getMethod() == 'POST')
{
$formI->bind($request);
if ($formI->isValid())
{
echo "form consentement valide";
$id=$consentement->getPeriode()->getId();
$em->persist($consentement);
$em->flush();
$id2=$consentement->getId();
return new RedirectResponse($this->container->get('router')
->generate('neka_periode_consentement_editer',array('periode' =>$id)));
}
}
if ($request->getMethod() == 'POST')
{
$choiceform->bind($request);
if ($choiceform->isValid())
{
echo "form choice valide";
$mesconsentement=$choiceform['id']->getData();
foreach($mesconsentement as $i){
$i->setPeriode($periode);
$em->flush();
}
return new RedirectResponse($this->container->get('router')
->generate('neka_periode_consentement_editer',array('periode' =>$periode->getId())));
}
}
if ($request->getMethod() == 'POST')
{
$formP->bind($request);
if ($formP->isValid())
{
echo"form periode valide";
$em->persist($periode);
$id=$periode->getId();
$em->flush();
return new RedirectResponse($this->container->get('router')
->generate('neka_periode_consentement_editer',array('periode' =>$id)));
}
}
if ($request->getMethod() == 'POST')
{
echo " form multiselect";
$options=$request->get('options') ;
$ids=$request->get('id');
if($options=='Retirer')
{
foreach($ids as $id){
$consentement = $em->find('ProjetConsentementBundle:Consentement', $id);
if (!$consentement)
{
$message="consentement non trouvée";
}
else
{
$Aucun= $em->getRepository('ProjetConsentementBundle:Periode')->findOneByNom("Nom");
$consentement->setPeriode($Aucun);
$em->flush();
}
}
return new RedirectResponse($this->container->get('router')
->generate('neka_periode_consentement_editer',array('periode' =>$periode->getId())));
}
}
return $this->container->get('templating')->renderResponse('ProjetConsentementBundle:Consentement:listerPeriodeConsentementEdit.html.twig',
array('consentement' => $consentement,'periode'=>$periode,'formP'=>$formP->createView(),'formI'=>$formI->createView(),'choiceform'=>$choiceform->createView(),'choices'=>$choices));
}
public function retirerAction($id)
{
$em = $this->container->get('doctrine')->getEntityManager();
$consentement= $em->getRepository('ProjetConsentementBundle:Consentement')->findOneById($id);
$consentement->setPeriode(null);
return $this->container->get('templating')->renderResponse('ProjetConsentementBundle::test.html.twig',
array('message' =>"ok"));
}
public function selectPeriodeConsentementAction($id)
{
$em = $this->container->get('doctrine')->getEntityManager();
}
} |
et voici les twig pour editer le consentement de la période
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
<div class="col-md-12">{# debut panneau du tableau#}
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Les consentement de la periode : {{ periode.getNom() }}</h3>
</div>
<div class="panel-body">
<div class="panel-body">
<table class="table table-bordered table-striped table-condensed ">
<thead>
<tr>
<th>nombre de client </th>
<th>Nombre de formulaire</th>
<th>Nombre de CR</th>
<th>Nombre de ligne</th>
<th>Nom Agences</th>
<th>Agent</th>
<th>TDC</th>
<th>TRC</th>
<th colspan="2"> Actions</th></tr>
</thead>
<tbody>
{% for c in consentement %}
<tr>
<td>{{ c.getNclient()}}</td>
<td>{{ c.getNbfor() }}</td>
<td>{{ c.getNcr()}}</td>
<td>{{ c.getNlcpm()}}</td>
<td>{% if c.periode is not null %} {{ c.periode.getNom()}}{% else %} {{" Aucun"}} {%endif%} </td>
<td>{% if c.agences is not null %}{{ c.agences.getNoma()}} {% else %} {{" Aucun"}} {%endif%}</td>
<td>{% if c.agent is not null %}{{ c.agent.getNomag()}}{% else %} {{" Aucun"}} {%endif%}</td>
<td>{{ c.getTdc()}}</td>
<td>{{ c.getTrc()}}</td>
</tr>
{% else %}
<tr><td>Aucun consentement n'a été trouvée.</td></tr>
{% endfor %}
</tbody>
</table>
</div>{# fin panneau du tableau#} |
merci d'avance