Bonjour,
J'essaye de créer un formulaire et je recois l'erreur " Expected argument of type "Boolean", "string" given".
J'ai lus sur d'autre forum au sujet d'une erreur similaire que cela pourrait venir de mon mapping d'entité. A savoir qu'une entité ne peut pas avoir :" * @ORM\Column(name="dateprevue", type="datetime", nullable=true)"
Je suis un peu perdu.
Voici mon contrôleur:
Mes entités:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 public function newAction($id) { $conso = new Conso(); $form = $this->createForm(new ConsoType, $conso); $request = $this->get('request'); if ($request->getMethod() == 'POST') { $form->bind($request); if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($uzer); $em->flush(); $this->get('session')->getFlashBag()->add('info', 'Article bien modifié'); return $this->redirect($this->generateUrl('uzer_gest_view_user', array('id' => $uzer->getId(),'uzer'=>$uzer))); } } return $this->render('SBConsoBundle:ConsoGest:newconso.html.twig', array('form' => $form->createView(),'id' => $id)); }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <?php namespace SB\ConsoBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Conso * * @ORM\Table() * @ORM\Entity(repositoryClass="SB\ConsoBundle\Entity\ConsoRepository") */ class Conso { /** * @ORM\OneToOne(targetEntity="SB\PrestaBundle\Entity\Presta") */ private $presta; /** * @ORM\OneToOne(targetEntity="SB\UserBundle\Entity\Uzer") */ private $uzer; /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var \DateTime * * @ORM\Column(name="dateprevue", type="datetime", nullable=true) */ private $dateprevue; /** * @var boolean * * @ORM\Column(name="fait", type="boolean") */ private $fait; /** * @var boolean * * @ORM\Column(name="paye", type="boolean") */ private $paye; /** * @var text * * @ORM\Column(name="Comment", type="text") */ private $comment; /** * Constructor */ public function __construct() { $this->fait = "false"; $this->paye = "false"; } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set dateprevue * * @param \DateTime $dateprevue * @return Conso */ public function setDateprevue($dateprevue) { $this->dateprevue = $dateprevue; return $this; } /** * Get dateprevue * * @return \DateTime */ public function getDateprevue() { return $this->dateprevue; } /** * Set fait * * @param boolean $fait * @return Conso */ public function setFait($fait) { $this->fait = $fait; return $this; } /** * Get fait * * @return boolean */ public function getFait() { return $this->fait; } /** * Set paye * * @param boolean $paye * @return Conso */ public function setPaye($paye) { $this->paye = $paye; return $this; } /** * Get paye * * @return boolean */ public function getPaye() { return $this->paye; } }
Partager