Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Le message d'erreur :
- Catchable Fatal Error: Object of class Uoi\DispoAppliBundle\Entity\Centre could not be converted to string in /appli/projects/PORTAIL-UOI/apache_2.2.24/htdocs/portail-alexandre/Symfony/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php line 67
- La classe :
- <?php
- namespace Uoi\DispoAppliBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * Centre
- *
- * @ORM\Table(name="centre")
- * @ORM\Entity(repositoryClass="Uoi\DispoAppliBundle\Entity\CentreRepository")
- */
- class Centre
- {
- /**
- * @var integer
- *
- * @ORM\Column(name="id", type="integer", nullable=false)
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="IDENTITY")
- */
- private $id;
- /**
- * @var string
- *
- * @ORM\Column(name="code", type="string", length=2, nullable=false)
- */
- private $code;
- /**
- * @var string
- *
- * @ORM\Column(name="nom", type="string", length=32, nullable=false)
- */
- private $nom;
- /**
- * @var string
- *
- * @ORM\Column(name="ville", type="string", length=32, nullable=false)
- */
- private $ville;
- /**
- * @var string
- *
- * @ORM\Column(name="centre_id", type="string", length=3, nullable=false)
- */
- private $centreId;
- /**
- * @var integer
- *
- * @ORM\Column(name="dir_id", type="integer", nullable=false)
- */
- private $dirId;
- /**
- * @var integer
- *
- * @ORM\Column(name="dr_id", type="integer", nullable=true)
- */
- private $drId;
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set code
- *
- * @param string $code
- * @return Centre
- */
- public function setCode($code)
- {
- $this->code = $code;
- return $this;
- }
- /**
- * Get code
- *
- * @return string
- */
- public function getCode()
- {
- return $this->code;
- }
- /**
- * Set nom
- *
- * @param string $nom
- * @return Centre
- */
- public function setNom($nom)
- {
- $this->nom = $nom;
- return $this;
- }
- /**
- * Get nom
- *
- * @return string
- */
- public function getNom()
- {
- return $this->nom;
- }
- /**
- * Set ville
- *
- * @param string $ville
- * @return Centre
- */
- public function setVille($ville)
- {
- $this->ville = $ville;
- return $this;
- }
- /**
- * Get ville
- *
- * @return string
- */
- public function getVille()
- {
- return $this->ville;
- }
- /**
- * Set centreId
- *
- * @param string $centreId
- * @return Centre
- */
- public function setCentreId($centreId)
- {
- $this->centreId = $centreId;
- return $this;
- }
- /**
- * Get centreId
- *
- * @return string
- */
- public function getCentreId()
- {
- return $this->centreId;
- }
- /**
- * Set dirId
- *
- * @param integer $dirId
- * @return Centre
- */
- public function setDirId($dirId)
- {
- $this->dirId = $dirId;
- return $this;
- }
- /**
- * Get dirId
- *
- * @return integer
- */
- public function getDirId()
- {
- return $this->dirId;
- }
- /**
- * Set drId
- *
- * @param integer $drId
- * @return Centre
- */
- public function setDrId($drId)
- {
- $this->drId = $drId;
- return $this;
- }
- /**
- * Get drId
- *
- * @return integer
- */
- public function getDrId()
- {
- return $this->drId;
- }
- }
- Et l'action :
- public function moduleAction()
- {
- $repositoryIndispo = $this->getDoctrine()->getRepository('UoiDispoAppliBundle:Indispo');
- $listeIndispo = $repositoryIndispo->listeIndispo();
- $repositoryAppli = $this->getDoctrine()->getRepository('UoiDispoAppliBundle:Application');
- $listeAppli = $repositoryAppli->findAll();
- $repoModule = $this->getDoctrine()->getRepository('UoiDispoAppliBundle:Module');
- $listeModule = $repoModule->listeModule();
- $entity = new Indispo();
- $form = $this->createForm(new IndispoType(), $entity);
- $em = $this->getDoctrine()->getManager();
- $request = $this->get('request');
- if ($request->getMethod() == 'POST') {
- $form->bind($request);
- if ($form->isValid()) {
- $em->persist($entity);
- $em->flush();
- }
- }
- return $this->render('UoiDispoAppliBundle:Afficher:module.html.twig',
- array(
- 'listeAppli' => $listeAppli,
- 'listeModule' => $listeModule,
- 'listeIndispo' => $listeIndispo,
- 'form' => $form->createView()
- ));
- }
- Log :
- INFO - Matched route "Uoi_DispoAppli_module" (parameters: "_controller": "Uoi\DispoAppliBundle\Controller\AfficherController::moduleAction", "_route": "Uoi_DispoAppli_module")
- INFO - Populated SecurityContext with an anonymous Token
- CRITICAL - Uncaught PHP Exception Doctrine\DBAL\DBALException: "An exception occurred while executing 'INSERT INTO indispo (date, heure_debut, heure_fin, application, centre, arret_prg, commentaire) VALUES (?, ?, ?, ?, ?, ?, ?)' with params ["2009-02-01", "01:01:00", "00:01:00", {}, {}, true, "y"]: Catchable Fatal Error: Object of class Uoi\DispoAppliBundle\Entity\Application could not be converted to string in /appli/projects/PORTAIL-UOI/apache_2.2.24/htdocs/portail-alexandre/Symfony/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php line 91" at /appli/projects/PORTAIL-UOI/apache_2.2.24/htdocs/portail-alexandre/Symfony/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php line 119
- Context: {"exception":"Object(Doctrine\\DBAL\\DBALException)"}
- Vue :
- {% extends '@UoiDispoAppli/layout.html.twig' %}
- {% block titre %}
- <strong>Vue 3 (module)</strong>
- {% endblock %}
- {% block affichage %}
- <div class="panel panel-default" >
- <div class="panel-heading">
- Ajout d'une indisponibilitée
- </div>
- <div class="panel-body">
- <form role="form" method="post" {{ form_enctype(form) }} >
- {{ form_widget(form) }}
- <input type="submit" class="btn btn-primary" />
- </form>
- </div>
- </div>
- {% endblock %}
- Form :
- public function buildForm(FormBuilderInterface $builder, array $options)
- {
- $builder
- ->add('date', 'date',
- array('empty_value' => array('day' => date("d"), 'month' => date("M"), 'year' => date("Y"))))
- ->add('heureDebut', 'time', array(
- 'input' => 'datetime',
- 'widget' => 'choice',
- 'empty_value' => array(
- 'hour' => date("H"),
- 'minute' => date("m")
- )
- ))
- ->add('heureFin', 'time', array(
- 'input' => 'datetime',
- 'widget' => 'choice',
- 'empty_value' => array(
- 'hour' => date("H"),
- 'minute' => date("m")
- )
- ))
- ->add('application', 'entity', array(
- 'required' => true,
- 'class' => 'Uoi\DispoAppliBundle\Entity\Application',
- 'property' => 'nom'
- ))
- ->add('centre', 'entity', array(
- 'required'=>true,
- 'class' => 'Uoi\DispoAppliBundle\Entity\Centre',
- 'property' => 'nom'))
- ->add('arretPrg', 'radio')
- ->add('commentaire');
- }
- Indispo :
- <?php
- namespace Uoi\DispoAppliBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * Indispo
- *
- * @ORM\Table(name="indispo", indexes={@ORM\Index(name="date_indispo", columns={"date", "heure_debut", "heure_fin", "application", "centre", "arret_prg"})})
- * @ORM\Entity(repositoryClass="Uoi\DispoAppliBundle\Entity\IndispoRepository")
- */
- class Indispo
- {
- /**
- * @var integer
- *
- * @ORM\Column(name="id", type="bigint", nullable=false)
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="IDENTITY")
- */
- private $id;
- /**
- * @var \DateTime
- *
- * @ORM\Column(name="date", type="date", nullable=false)
- */
- private $date;
- /**
- * @var \DateTime
- *
- * @ORM\Column(name="heure_debut", type="time", nullable=false)
- */
- private $heureDebut;
- /**
- * @var \DateTime
- *
- * @ORM\Column(name="heure_fin", type="time", nullable=false)
- */
- private $heureFin;
- /**
- * @var integer
- *
- * @ORM\Column(name="application", type="smallint", nullable=false)
- */
- private $application;
- /**
- * @var string
- *
- * @ORM\Column(name="centre", type="string", length=350, nullable=false)
- */
- private $centre;
- /**
- * @var string
- *
- * @ORM\Column(name="arret_prg", type="string", length=4, nullable=false)
- */
- private $arretPrg;
- /**
- * @var string
- *
- * @ORM\Column(name="commentaire", type="text", nullable=false)
- */
- private $commentaire;
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set date
- *
- * @param \DateTime $date
- * @return Indispo
- */
- public function setDate($date)
- {
- $this->date = $date;
- return $this;
- }
- /**
- * Get date
- *
- * @return \DateTime
- */
- public function getDate()
- {
- return $this->date;
- }
- /**
- * Set heureDebut
- *
- * @param \DateTime $heureDebut
- * @return Indispo
- */
- public function setHeureDebut($heureDebut)
- {
- $this->heureDebut = $heureDebut;
- return $this;
- }
- /**
- * Get heureDebut
- *
- * @return \DateTime
- */
- public function getHeureDebut()
- {
- return $this->heureDebut;
- }
- /**
- * Set heureFin
- *
- * @param \DateTime $heureFin
- * @return Indispo
- */
- public function setHeureFin($heureFin)
- {
- $this->heureFin = $heureFin;
- return $this;
- }
- /**
- * Get heureFin
- *
- * @return \DateTime
- */
- public function getHeureFin()
- {
- return $this->heureFin;
- }
- /**
- * Set application
- *
- * @param integer $application
- * @return Indispo
- */
- public function setApplication($application)
- {
- $this->application = $application;
- return $this;
- }
- /**
- * Get application
- *
- * @return integer
- */
- public function getApplication()
- {
- return $this->application;
- }
- /**
- * Set centre
- *
- * @param string $centre
- * @return Indispo
- */
- public function setCentre($centre)
- {
- $this->centre = $centre;
- return $this;
- }
- /**
- * Get centre
- *
- * @return string
- */
- public function getCentre()
- {
- return $this->centre;
- }
- /**
- * Set arretPrg
- *
- * @param string $arretPrg
- * @return Indispo
- */
- public function setArretPrg($arretPrg)
- {
- $this->arretPrg = $arretPrg;
- return $this;
- }
- /**
- * Get arretPrg
- *
- * @return string
- */
- public function getArretPrg()
- {
- return $this->arretPrg;
- }
- /**
- * Set commentaire
- *
- * @param string $commentaire
- * @return Indispo
- */
- public function setCommentaire($commentaire)
- {
- $this->commentaire = $commentaire;
- return $this;
- }
- /**
- * Get commentaire
- *
- * @return string
- */
- public function getCommentaire()
- {
- return $this->commentaire;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement