Bonjour,
j'ai un soucis avec le bundle pagerfantaBundle.
voici mes entity
Personel_Medicale
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
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416 class Patient { /** * @var integer $id * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string $Nom * * @ORM\Column(name="Nom", type="string", length=25) * */ private $Nom; /** * @var string $Prenom * * @ORM\Column(name="Prenom", type="string", length=25) * */ private $Prenom; /** * @var string $Sex * * @ORM\Column(name="Sex", type="string", length=1) */ private $Sex; /** * @var string $NumeroSecurite * * @ORM\Column(name="NumeroSecurite", type="string", length=255) */ private $NumeroSecurite; /** * @var string $Rue_patient * * @ORM\Column(name="Rue_patient", type="string", length=255) */ private $Rue_patient; /** * @var string $Cp * * @ORM\Column(name="Cp", type="string", length=25) */ private $Cp; /** * @var string $Ville * * @ORM\Column(name="Ville", type="string", length=25) */ private $Ville; /** * @var string $Mail * * @ORM\Column(name="Mail", type="string", length=25) */ private $Mail; /** * @var datetime $Naissance * * @ORM\Column(name="Naissance", type="datetime", unique=true) */ private $Naissance; /** * @var integer $Pack * * @ORM\Column(name="Pack", type="integer") */ private $Pack; /** * @var string $Password * * @ORM\Column(name="Password", type="string", length=255) */ private $Password; /** * * @ORM\ManyToOne(targetEntity="Tvs\PatientBundle\Entity\Personel_medicale") */ public $Medecin_traitant; /** * * @ORM\ManyToMany (targetEntity="Tvs\PatientBundle\Entity\Personel_Medicale", inversedBy="patiens") * */ public $praticiens; /** * Constructeur */ public function __construct() { $this->praticiens = new \Doctrine\Common\Collections\ArrayCollection; } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set Id * * @param integer $id */ public function setId($id) { $this->Id = $id; } /** * Set Nom * * @param string $nom */ public function setNom($nom) { $this->Nom = $nom; } /** * Get Nom * * @return string */ public function getNom() { return $this->Nom; } /** * Set Prenom * * @param string $prenom */ public function setPrenom($prenom) { $this->Prenom = $prenom; } /** * Get Prenom * * @return string */ public function getPrenom() { return $this->Prenom; } /** * Set Sex * * @param string $sex */ public function setSex($sex) { $this->Sex = $sex; } /** * Get Sex * * @return string */ public function getSex() { return $this->Sex; } /** * Set NumeroSecurite * * @param string $numeroSecurite */ public function setNumeroSecurite($numeroSecurite) { $this->NumeroSecurite = $numeroSecurite; } /** * Get NumeroSecurite * * @return string */ public function getNumeroSecurite() { return $this->NumeroSecurite; } /** * Set Rue_patient * * @param string $ruePatient */ public function setRuePatient($ruePatient) { $this->Rue_patient = $ruePatient; } /** * Get Rue_patient * * @return string */ public function getRuePatient() { return $this->Rue_patient; } /** * Set Cp * * @param string $cp */ public function setCp($cp) { $this->Cp = $cp; } /** * Get Cp * * @return string */ public function getCp() { return $this->Cp; } /** * Set Ville * * @param string $ville */ public function setVille($ville) { $this->Ville = $ville; } /** * Get Ville * * @return string */ public function getVille() { return $this->Ville; } /** * Set Mail * * @param string $mail */ public function setMail($mail) { $this->Mail = $mail; } /** * Get Mail * * @return string */ public function getMail() { return $this->Mail; } /** * Set Naissance * * @param datetime $naissance */ public function setNaissance($naissance) { $this->Naissance = $naissance; } /** * Get Naissance * * @return datetime */ public function getNaissance() { return $this->Naissance; } /** * Set Pack * * @param integer $pack */ public function setPack($pack) { $this->Pack = $pack; } public function getNumPack() { return $this->Pack; } /** * Get Pack * * @return integer */ public function getPack() { // petit modification switch($this->Pack) { case 1 : return "Limité";break; case 2 : return "Compte avec suivi et document en ligne";break; case 3 : return "Compte avec suivi et agenda en ligne";break; case 4 : return "Compte avec suivi, agenda et document en ligne";break; case 5 : return "Compte Illimté"; default : return "Limité";break; } } /** * Set Password * * @param string $password */ public function setPassword($password) { $this->Password = md5($password); } /** * Get Password * * @return string */ public function getPassword() { return $this->Password; } /** * Get Medecin_traitant * * * @return Personel_medicale */ public function getMedecin_traitant() { return $this->Medecin_traitant; } /** * * @param \Tvs\PatientBundle\Entity\Personel_Medicale $newMedecin */ public function setMedecin_traitant(\Tvs\PatientBundle\Entity\Personel_Medicale $newMedecin) { $this->Medecin_traitant = $newMedecin; } /** * * @return Ojbect personel_medicale */ public function getPraticiens() { return $this->praticiens; } /** * * @param \Tvs\PatientBundle\Entity\Personel_medicale $newPraticien */ public function setPraticiens(\Tvs\PatientBundle\Entity\Personel_Medicale $newPraticien) { $this->praticiens[] = $newPraticien; } }
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
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325 /** * @var integer $id * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string $Nom * * @ORM\Column(name="Nom", type="string", length=25) */ private $Nom; /** * @var string $Prenom * * @ORM\Column(name="Prenom", type="string", length=25) */ private $Prenom; /** * @var string $Adresse * * @ORM\Column(name="Adresse", type="string", length=50) */ private $Adresse; /** * @var string $CodePostal * * @ORM\Column(name="CodePostal", type="string", length=25) */ private $CodePostal; /** * @var string $Ville * * @ORM\Column(name="Ville", type="string", length=25) */ private $Ville; /** * @var boolean $IsUse * * @ORM\Column(name="IsUse", type="boolean") */ private $IsUse; /** * @var integer $Pack * * @ORM\Column(name="Pack", type="integer") */ private $Pack; /** * @var string $Mail * * @ORM\Column(name="Mail", type="string", length=255) */ private $Mail; /** * @var object $Type * * @ORM\ManyToOne(targetEntity="Tvs\PatientBundle\Entity\Type_personel") */ private $Type; /** * @ORM\ManyToMany (targetEntity="Tvs\PatientBundle\Entity\Patient", mappedBy="praticiens") */ protected $patients; /** * @var interger $Tel * * @ORM\Column(name="Tel", type="string", length=10) */ private $Tel; /** * */ public function __construct() { $this->patients = new \Doctrine\Common\Collections\ArrayCollection; } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set Nom * * @param string $nom */ public function setNom($nom) { $this->Nom = $nom; } /** * Get Nom * * @return string */ public function getNom() { return $this->Nom; } /** * Set Prenom * * @param string $prenom */ public function setPrenom($prenom) { $this->Prenom = $prenom; } /** * Get Prenom * * @return string */ public function getPrenom() { return $this->Prenom; } /** * Set Adresse * * @param string $adresse */ public function setAdresse($adresse) { $this->Adresse = $adresse; } /** * Get Adresse * * @return string */ public function getAdresse() { return $this->Adresse; } /** * Set CodePostal * * @param string $codePostal */ public function setCodePostal($codePostal) { $this->CodePostal = $codePostal; } /** * Get CodePostal * * @return string */ public function getCodePostal() { return $this->CodePostal; } /** * Set Ville * * @param string $ville */ public function setVille($ville) { $this->Ville = $ville; } /** * Get Ville * * @return string */ public function getVille() { return $this->Ville; } /** * Set IsUse * * @param boolean $isUse */ public function setIsUse($isUse) { $this->IsUse = $isUse; } /** * Get IsUse * * @return boolean */ public function getIsUse() { return $this->IsUse; } /** * Set Pack * * @param integer $pack */ public function setPack($pack) { $this->Pack = $pack; } /** * Get Pack * * @return integer */ public function getPack() { return $this->Pack; } /** * Set Mail * * @param string $mail */ public function setMail($mail) { $this->Mail = $mail; } /** * Get Mail * * @return string */ public function getMail() { return $this->Mail; } /** *Get Type * * @return Type_personel */ public function getType() { return $this->Type; } /** * Set Type * * @param Object Type_personel_medicale */ public function setType(\Tvs\PatientBundle\Entity\Type_personel $newtype) { $this->Type = $newtype; } /** * * @return Object Patient */ public function getPatiens() { return $this->patients; } /** * * @param \Tvs\PatientBundle\Entity\Patient $newPatient */ public function setPatient(\Tvs\PatientBundle\Entity\Patient $newPatient) { $this->patients[] = $newPatient; } /** * Set Tel * * @param string $tel */ public function setTel($tel) { $this->Tel = $tel; } /** * Get Tel * * @return string Tel */ public function getTel() { return $this->Tel; }
Mon action
pour finir voici le code dans ma page twig
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 public function profilAction($id) { $currentmedecin = $this->getDoctrine()->getRepository("PatientBundle:Personel_Medicale")->find($id); if(!$currentmedecin) { throw $this->createNotFoundException("l'identifiant n'est peut être pas (ou plus) valide"); } $qb = $this->getDoctrine()->getEntityManager()->createQueryBuilder() ->select('patients') ->from('Tvs\PatientBundle\Entity\Personel_Medicale', 'patients'); $adapter = new DoctrineORMAdapter($qb); $paginator = new Pagerfanta($adapter); $paginator->getMaxPerPage(10); $paginator->setCurrentPage($this->get('request')->query->get('page',1), false, true); $entities = $paginator->getCurrentPageResults(); return $this->render("PatientBundle:Personel_Medicale:Profil.html.twig", array("medecin"=> $currentmedecin, "patients"=>$entities )); }
Code : Sélectionner tout - Visualiser dans une fenêtre à part {{pagerfanta(patients, 'default')}}
les code erreurs sont :
Code : Sélectionner tout - Visualiser dans une fenêtre à part [1/2] ErrorException: Catchable Fatal Error: Argument 1 passed to WhiteOctober\PagerfantaBundle\Twig\PagerfantaExtension::renderPagerfanta() must implement interface Pagerfanta\PagerfantaInterface, instance of ArrayIterator given, called in C:\wamp\www\suivi\Symfony\app\cache\dev\twig\65\29\c2b9bb62812eee50d1d4b9ab9006.php on line 87 and defined in C:\wamp\www\suivi\Symfony\vendor\bundles\WhiteOctober\PagerfantaBundle\Twig\PagerfantaExtension.php line 56j'aimerais savoir ce que je fais mal ^^
Code : Sélectionner tout - Visualiser dans une fenêtre à part [2/2] Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("Catchable Fatal Error: Argument 1 passed to WhiteOctober\PagerfantaBundle\Twig\PagerfantaExtension::renderPagerfanta() must implement interface Pagerfanta\PagerfantaInterface, instance of ArrayIterator given, called in C:\wamp\www\suivi\Symfony\app\cache\dev\twig\65\29\c2b9bb62812eee50d1d4b9ab9006.php on line 87 and defined in C:\wamp\www\suivi\Symfony\vendor\bundles\WhiteOctober\PagerfantaBundle\Twig\PagerfantaExtension.php line 56") in PatientBundle:Personel_Medicale:Profil.html.twig at line 42.
parce que là je vois vraiment pas
/*************************** Resolution *********************/
N'ayant pas trouver je contourne le problème j'utilise
https://github.com/KnpLabs/KnpPaginatorBundle
pour paginer l'est beaucoup mieux enfin je trouve !
![]()
Partager