Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.70 KB | None | 0 0
  1. Le message d'erreur :
  2.  
  3. 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
  4.  
  5. La classe :
  6.  
  7. <?php
  8.  
  9. namespace Uoi\DispoAppliBundle\Entity;
  10.  
  11. use Doctrine\ORM\Mapping as ORM;
  12.  
  13. /**
  14. * Centre
  15. *
  16. * @ORM\Table(name="centre")
  17. * @ORM\Entity(repositoryClass="Uoi\DispoAppliBundle\Entity\CentreRepository")
  18. */
  19. class Centre
  20. {
  21. /**
  22. * @var integer
  23. *
  24. * @ORM\Column(name="id", type="integer", nullable=false)
  25. * @ORM\Id
  26. * @ORM\GeneratedValue(strategy="IDENTITY")
  27. */
  28. private $id;
  29.  
  30. /**
  31. * @var string
  32. *
  33. * @ORM\Column(name="code", type="string", length=2, nullable=false)
  34. */
  35. private $code;
  36.  
  37. /**
  38. * @var string
  39. *
  40. * @ORM\Column(name="nom", type="string", length=32, nullable=false)
  41. */
  42. private $nom;
  43.  
  44. /**
  45. * @var string
  46. *
  47. * @ORM\Column(name="ville", type="string", length=32, nullable=false)
  48. */
  49. private $ville;
  50.  
  51. /**
  52. * @var string
  53. *
  54. * @ORM\Column(name="centre_id", type="string", length=3, nullable=false)
  55. */
  56. private $centreId;
  57.  
  58. /**
  59. * @var integer
  60. *
  61. * @ORM\Column(name="dir_id", type="integer", nullable=false)
  62. */
  63. private $dirId;
  64.  
  65. /**
  66. * @var integer
  67. *
  68. * @ORM\Column(name="dr_id", type="integer", nullable=true)
  69. */
  70. private $drId;
  71.  
  72.  
  73.  
  74. /**
  75. * Get id
  76. *
  77. * @return integer
  78. */
  79. public function getId()
  80. {
  81. return $this->id;
  82. }
  83.  
  84. /**
  85. * Set code
  86. *
  87. * @param string $code
  88. * @return Centre
  89. */
  90. public function setCode($code)
  91. {
  92. $this->code = $code;
  93.  
  94. return $this;
  95. }
  96.  
  97. /**
  98. * Get code
  99. *
  100. * @return string
  101. */
  102. public function getCode()
  103. {
  104. return $this->code;
  105. }
  106.  
  107. /**
  108. * Set nom
  109. *
  110. * @param string $nom
  111. * @return Centre
  112. */
  113. public function setNom($nom)
  114. {
  115. $this->nom = $nom;
  116.  
  117. return $this;
  118. }
  119.  
  120. /**
  121. * Get nom
  122. *
  123. * @return string
  124. */
  125. public function getNom()
  126. {
  127. return $this->nom;
  128. }
  129.  
  130. /**
  131. * Set ville
  132. *
  133. * @param string $ville
  134. * @return Centre
  135. */
  136. public function setVille($ville)
  137. {
  138. $this->ville = $ville;
  139.  
  140. return $this;
  141. }
  142.  
  143. /**
  144. * Get ville
  145. *
  146. * @return string
  147. */
  148. public function getVille()
  149. {
  150. return $this->ville;
  151. }
  152.  
  153. /**
  154. * Set centreId
  155. *
  156. * @param string $centreId
  157. * @return Centre
  158. */
  159. public function setCentreId($centreId)
  160. {
  161. $this->centreId = $centreId;
  162.  
  163. return $this;
  164. }
  165.  
  166. /**
  167. * Get centreId
  168. *
  169. * @return string
  170. */
  171. public function getCentreId()
  172. {
  173. return $this->centreId;
  174. }
  175.  
  176. /**
  177. * Set dirId
  178. *
  179. * @param integer $dirId
  180. * @return Centre
  181. */
  182. public function setDirId($dirId)
  183. {
  184. $this->dirId = $dirId;
  185.  
  186. return $this;
  187. }
  188.  
  189. /**
  190. * Get dirId
  191. *
  192. * @return integer
  193. */
  194. public function getDirId()
  195. {
  196. return $this->dirId;
  197. }
  198.  
  199. /**
  200. * Set drId
  201. *
  202. * @param integer $drId
  203. * @return Centre
  204. */
  205. public function setDrId($drId)
  206. {
  207. $this->drId = $drId;
  208.  
  209. return $this;
  210. }
  211.  
  212. /**
  213. * Get drId
  214. *
  215. * @return integer
  216. */
  217. public function getDrId()
  218. {
  219. return $this->drId;
  220. }
  221. }
  222.  
  223. Et l'action :
  224.  
  225. public function moduleAction()
  226. {
  227. $repositoryIndispo = $this->getDoctrine()->getRepository('UoiDispoAppliBundle:Indispo');
  228. $listeIndispo = $repositoryIndispo->listeIndispo();
  229.  
  230. $repositoryAppli = $this->getDoctrine()->getRepository('UoiDispoAppliBundle:Application');
  231. $listeAppli = $repositoryAppli->findAll();
  232. $repoModule = $this->getDoctrine()->getRepository('UoiDispoAppliBundle:Module');
  233. $listeModule = $repoModule->listeModule();
  234.  
  235. $entity = new Indispo();
  236. $form = $this->createForm(new IndispoType(), $entity);
  237.  
  238. $em = $this->getDoctrine()->getManager();
  239.  
  240.  
  241. $request = $this->get('request');
  242. if ($request->getMethod() == 'POST') {
  243. $form->bind($request);
  244. if ($form->isValid()) {
  245.  
  246. $em->persist($entity);
  247. $em->flush();
  248.  
  249.  
  250. }
  251. }
  252.  
  253. return $this->render('UoiDispoAppliBundle:Afficher:module.html.twig',
  254. array(
  255. 'listeAppli' => $listeAppli,
  256. 'listeModule' => $listeModule,
  257. 'listeIndispo' => $listeIndispo,
  258. 'form' => $form->createView()
  259. ));
  260.  
  261. }
  262.  
  263. Log :
  264.  
  265.  
  266. INFO - Matched route "Uoi_DispoAppli_module" (parameters: "_controller": "Uoi\DispoAppliBundle\Controller\AfficherController::moduleAction", "_route": "Uoi_DispoAppli_module")
  267. INFO - Populated SecurityContext with an anonymous Token
  268. 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
  269. Context: {"exception":"Object(Doctrine\\DBAL\\DBALException)"}
  270.  
  271.  
  272. Vue :
  273.  
  274. {% extends '@UoiDispoAppli/layout.html.twig' %}
  275. {% block titre %}
  276. <strong>Vue 3 (module)</strong>
  277. {% endblock %}
  278. {% block affichage %}
  279.  
  280. <div class="panel panel-default" >
  281. <div class="panel-heading">
  282. Ajout d'une indisponibilitée
  283. </div>
  284. <div class="panel-body">
  285. <form role="form" method="post" {{ form_enctype(form) }} >
  286. {{ form_widget(form) }}
  287. <input type="submit" class="btn btn-primary" />
  288. </form>
  289. </div>
  290. </div>
  291.  
  292. {% endblock %}
  293.  
  294. Form :
  295. public function buildForm(FormBuilderInterface $builder, array $options)
  296. {
  297.  
  298. $builder
  299. ->add('date', 'date',
  300. array('empty_value' => array('day' => date("d"), 'month' => date("M"), 'year' => date("Y"))))
  301. ->add('heureDebut', 'time', array(
  302. 'input' => 'datetime',
  303. 'widget' => 'choice',
  304. 'empty_value' => array(
  305. 'hour' => date("H"),
  306. 'minute' => date("m")
  307. )
  308. ))
  309. ->add('heureFin', 'time', array(
  310. 'input' => 'datetime',
  311. 'widget' => 'choice',
  312. 'empty_value' => array(
  313. 'hour' => date("H"),
  314. 'minute' => date("m")
  315. )
  316. ))
  317. ->add('application', 'entity', array(
  318. 'required' => true,
  319. 'class' => 'Uoi\DispoAppliBundle\Entity\Application',
  320. 'property' => 'nom'
  321. ))
  322. ->add('centre', 'entity', array(
  323. 'required'=>true,
  324. 'class' => 'Uoi\DispoAppliBundle\Entity\Centre',
  325. 'property' => 'nom'))
  326. ->add('arretPrg', 'radio')
  327. ->add('commentaire');
  328. }
  329.  
  330. Indispo :
  331.  
  332. <?php
  333.  
  334. namespace Uoi\DispoAppliBundle\Entity;
  335.  
  336. use Doctrine\ORM\Mapping as ORM;
  337.  
  338. /**
  339. * Indispo
  340. *
  341. * @ORM\Table(name="indispo", indexes={@ORM\Index(name="date_indispo", columns={"date", "heure_debut", "heure_fin", "application", "centre", "arret_prg"})})
  342. * @ORM\Entity(repositoryClass="Uoi\DispoAppliBundle\Entity\IndispoRepository")
  343. */
  344. class Indispo
  345. {
  346. /**
  347. * @var integer
  348. *
  349. * @ORM\Column(name="id", type="bigint", nullable=false)
  350. * @ORM\Id
  351. * @ORM\GeneratedValue(strategy="IDENTITY")
  352. */
  353. private $id;
  354.  
  355. /**
  356. * @var \DateTime
  357. *
  358. * @ORM\Column(name="date", type="date", nullable=false)
  359. */
  360. private $date;
  361.  
  362. /**
  363. * @var \DateTime
  364. *
  365. * @ORM\Column(name="heure_debut", type="time", nullable=false)
  366. */
  367. private $heureDebut;
  368.  
  369. /**
  370. * @var \DateTime
  371. *
  372. * @ORM\Column(name="heure_fin", type="time", nullable=false)
  373. */
  374. private $heureFin;
  375.  
  376. /**
  377. * @var integer
  378. *
  379. * @ORM\Column(name="application", type="smallint", nullable=false)
  380. */
  381. private $application;
  382.  
  383. /**
  384. * @var string
  385. *
  386. * @ORM\Column(name="centre", type="string", length=350, nullable=false)
  387. */
  388. private $centre;
  389.  
  390. /**
  391. * @var string
  392. *
  393. * @ORM\Column(name="arret_prg", type="string", length=4, nullable=false)
  394. */
  395. private $arretPrg;
  396.  
  397. /**
  398. * @var string
  399. *
  400. * @ORM\Column(name="commentaire", type="text", nullable=false)
  401. */
  402. private $commentaire;
  403.  
  404.  
  405.  
  406. /**
  407. * Get id
  408. *
  409. * @return integer
  410. */
  411. public function getId()
  412. {
  413. return $this->id;
  414. }
  415.  
  416. /**
  417. * Set date
  418. *
  419. * @param \DateTime $date
  420. * @return Indispo
  421. */
  422. public function setDate($date)
  423. {
  424. $this->date = $date;
  425.  
  426. return $this;
  427. }
  428.  
  429. /**
  430. * Get date
  431. *
  432. * @return \DateTime
  433. */
  434. public function getDate()
  435. {
  436. return $this->date;
  437. }
  438.  
  439. /**
  440. * Set heureDebut
  441. *
  442. * @param \DateTime $heureDebut
  443. * @return Indispo
  444. */
  445. public function setHeureDebut($heureDebut)
  446. {
  447. $this->heureDebut = $heureDebut;
  448.  
  449. return $this;
  450. }
  451.  
  452. /**
  453. * Get heureDebut
  454. *
  455. * @return \DateTime
  456. */
  457. public function getHeureDebut()
  458. {
  459. return $this->heureDebut;
  460. }
  461.  
  462. /**
  463. * Set heureFin
  464. *
  465. * @param \DateTime $heureFin
  466. * @return Indispo
  467. */
  468. public function setHeureFin($heureFin)
  469. {
  470. $this->heureFin = $heureFin;
  471.  
  472. return $this;
  473. }
  474.  
  475. /**
  476. * Get heureFin
  477. *
  478. * @return \DateTime
  479. */
  480. public function getHeureFin()
  481. {
  482. return $this->heureFin;
  483. }
  484.  
  485. /**
  486. * Set application
  487. *
  488. * @param integer $application
  489. * @return Indispo
  490. */
  491. public function setApplication($application)
  492. {
  493. $this->application = $application;
  494.  
  495. return $this;
  496. }
  497.  
  498. /**
  499. * Get application
  500. *
  501. * @return integer
  502. */
  503. public function getApplication()
  504. {
  505. return $this->application;
  506. }
  507.  
  508. /**
  509. * Set centre
  510. *
  511. * @param string $centre
  512. * @return Indispo
  513. */
  514. public function setCentre($centre)
  515. {
  516. $this->centre = $centre;
  517.  
  518. return $this;
  519. }
  520.  
  521. /**
  522. * Get centre
  523. *
  524. * @return string
  525. */
  526. public function getCentre()
  527. {
  528. return $this->centre;
  529. }
  530.  
  531. /**
  532. * Set arretPrg
  533. *
  534. * @param string $arretPrg
  535. * @return Indispo
  536. */
  537. public function setArretPrg($arretPrg)
  538. {
  539. $this->arretPrg = $arretPrg;
  540.  
  541. return $this;
  542. }
  543.  
  544. /**
  545. * Get arretPrg
  546. *
  547. * @return string
  548. */
  549. public function getArretPrg()
  550. {
  551. return $this->arretPrg;
  552. }
  553.  
  554. /**
  555. * Set commentaire
  556. *
  557. * @param string $commentaire
  558. * @return Indispo
  559. */
  560. public function setCommentaire($commentaire)
  561. {
  562. $this->commentaire = $commentaire;
  563.  
  564. return $this;
  565. }
  566.  
  567. /**
  568. * Get commentaire
  569. *
  570. * @return string
  571. */
  572. public function getCommentaire()
  573. {
  574. return $this->commentaire;
  575. }
  576. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement