Bonjour,
J'ai un gros souci que je n'arrive pas à résoudre :
Je ne comprends pas pourquoi ça cherche une classe timestamp. Je soupçonne un problème au niveau d'une définition d'une relation many to many dans mon modèle.Stack Trace
in /home/benoit/sf2projects/gretabotv2/vendor/doctrine/lib/Doctrine/ORM/Proxy/ProxyFactory.php at line 194 -+
}
// We need to pick the type hint class too
if (($paramClass = $param->getClass()) !== null) {
$parameterString .= '\\' . $paramClass->getName() . ' ';
} else if ($param->isArray()) {
$parameterString .= 'array ';
at ReflectionParameter ->getClass ()
in /home/benoit/sf2projects/gretabotv2/vendor/doctrine/lib/Doctrine/ORM/Proxy/ProxyFactory.php at line 194 -+
at ProxyFactory ->_generateMethods (object(ClassMetadata))
in /home/benoit/sf2projects/gretabotv2/vendor/doctrine/lib/Doctrine/ORM/Proxy/ProxyFactory.php at line 131 -+
at ProxyFactory ->_generateProxyClass (object(ClassMetadata), 'AcDijonGretabotBundleEntityDomaineProxy', '/home/benoit/sf2projects/gretabotv2/app/cache/dev/doctrine/orm/Proxies/AcDijonGretabotBundleEntityDomaineProxy.php', '<?php namespace <namespace>; /** * THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE. */ class <proxyClassName> extends \<className> implements \Doctrine\ORM\Proxy\Proxy { private $_entityPersister; private $_identifier; public $__isInitialized__ = false; public function __construct($entityPersister, $identifier) { $this->_entityPersister = $entityPersister; $this->_identifier = $identifier; } /** @private */ public function __load() { if (!$this->__isInitialized__ && $this->_entityPersister) { $this->__isInitialized__ = true; if (method_exists($this, "__wakeup")) { // call this after __isInitialized__to avoid infinite recursion // but before loading to emulate what ClassMetadata::newInstance() // provides. $this->__wakeup(); } if ($this->_entityPersister->load($this->_identifier, $this) === null) { throw new \Doctrine\ORM\EntityNotFoundException(); } unset($this->_entityPersister, $this->_identifier); } } <methods> public function __sleep() { <sleepImpl> } public function __clone() { if (!$this->__isInitialized__ && $this->_entityPersister) { $this->__isInitialized__ = true; $class = $this->_entityPersister->getClassMetadata(); $original = $this->_entityPersister->load($this->_identifier); if ($original === null) { throw new \Doctrine\ORM\EntityNotFoundException(); } foreach ($class->reflFields AS $field => $reflProperty) { $reflProperty->setValue($this, $reflProperty->getValue($original)); } unset($this->_entityPersister, $this->_identifier); } <cloneImpl> } }')
in /home/benoit/sf2projects/gretabotv2/vendor/doctrine/lib/Doctrine/ORM/Proxy/ProxyFactory.php at line 83 -+
at ProxyFactory ->getProxy ('AcDijon\GretabotBundle\Entity\Domaine', array('id' => '2'))
in /home/benoit/sf2projects/gretabotv2/vendor/doctrine/lib/Doctrine/ORM/UnitOfWork.php at line 2071 -+
at UnitOfWork ->createEntity ('AcDijon\GretabotBundle\Entity\SousDomaine', array('id' => '18', 'nom' => 'Aménagement paysager', 'numero' => '201', 'slug' => 'amenagement-paysager', 'created' => object(DateTime), 'updated' => object(DateTime), 'deletedAt' => null, 'domaine_id' => '2'), array('deferEagerLoad' => true, 'fetchAlias' => 'p', 'fetchMode' => array('AcDijon\GretabotBundle\Entity\SousDomaine' => array('domaine' => '2'))))
in /home/benoit/sf2projects/gretabotv2/vendor/doctrine/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php at line 208 -+
at ObjectHydrator ->_getEntity (array('id' => '18', 'nom' => 'Aménagement paysager', 'numero' => '201', 'slug' => 'amenagement-paysager', 'created' => object(DateTime), 'updated' => object(DateTime), 'deletedAt' => null, 'domaine_id' => '2'), 'p')
in /home/benoit/sf2projects/gretabotv2/vendor/doctrine/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php at line 429 -+
at ObjectHydrator ->_hydrateRow (array('id0' => '18', 'nom1' => 'Aménagement paysager', 'numero2' => '201', 'slug3' => 'amenagement-paysager', 'created4' => '2012-03-29 11:01:41', 'updated5' => '2012-03-29 11:01:41', 'deleted_at6' => null, 'domaine_id7' => '2'), array('id0' => array('fieldName' => 'id', 'type' => object(IntegerType), 'isIdentifier' => true, 'dqlAlias' => 'p'), 'nom1' => array('fieldName' => 'nom', 'type' => object(StringType), 'isIdentifier' => false, 'dqlAlias' => 'p'), 'numero2' => array('fieldName' => 'numero', 'type' => object(IntegerType), 'isIdentifier' => false, 'dqlAlias' => 'p'), 'slug3' => array('fieldName' => 'slug', 'type' => object(StringType), 'isIdentifier' => false, 'dqlAlias' => 'p'), 'created4' => array('fieldName' => 'created', 'type' => object(DateTimeType), 'isIdentifier' => false, 'dqlAlias' => 'p'), 'updated5' => array('fieldName' => 'updated', 'type' => object(DateTimeType), 'isIdentifier' => false, 'dqlAlias' => 'p'), 'deleted_at6' => array('fieldName' => 'deletedAt', 'type' => object(DateTimeType), 'isIdentifier' => false, 'dqlAlias' => 'p'), 'domaine_id7' => array('isMetaColumn' => true, 'fieldName' => 'domaine_id', 'dqlAlias' => 'p', 'isIdentifier' => false)), array())
in /home/benoit/sf2projects/gretabotv2/vendor/doctrine/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php at line 133 -+
at ObjectHydrator ->_hydrateAll ()
in /home/benoit/sf2projects/gretabotv2/vendor/doctrine/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php at line 99 -+
at AbstractHydrator ->hydrateAll (object(PDOStatement), object(ResultSetMapping), array())
in /home/benoit/sf2projects/gretabotv2/vendor/doctrine/lib/Doctrine/ORM/AbstractQuery.php at line 615 -+
at AbstractQuery ->execute (array(), '1')
in /home/benoit/sf2projects/gretabotv2/vendor/doctrine/lib/Doctrine/ORM/AbstractQuery.php at line 413 -+
at AbstractQuery ->getResult ()
in /home/benoit/sf2projects/gretabotv2/src/AcDijon/GretabotBundle/Repository/SousDomaineRepository.php at line 21 -+
at SousDomaineRepository ->findAllOrderedByName ()
in /home/benoit/sf2projects/gretabotv2/src/AcDijon/GretabotBundle/Controller/Admin/SousDomaineController.php at line 24 -+
at SousDomaineController ->indexAction ()
at call_user_func_array (array(object(SousDomaineController), 'indexAction'), array())
in kernel.root_dir/cache/dev/classes.php at line 3905 -+
at HttpKernel ->handleRaw (object(Request), '1')
in kernel.root_dir/cache/dev/classes.php at line 3875 -+
at HttpKernel ->handle (object(Request), '1', true)
in kernel.root_dir/cache/dev/classes.php at line 4879 -+
at HttpKernel ->handle (object(Request), '1', true)
in kernel.root_dir/bootstrap.php.cache at line 547 -+
at Kernel ->handle (object(Request))
in /home/benoit/sf2projects/gretabotv2/web/app_dev.php at line 24 -
Voici donc l'entity concernée :
L'action :
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 <?php /** * Description of SousDomaine */ namespace ****\****\Entity; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity(repositoryClass="****\****\Repository\SousDomaineRepository") * @ORM\Table(name="gbot_SousDomaine") * @Gedmo\SoftDeleteable(fieldName="deletedAt") */ class SousDomaine { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue */ protected $id; /** * @ORM\Column(type="string", length=255, nullable=false) * @Assert\NotBlank(message="L'intitulé doit être renseigné") */ protected $nom; /** * * @var integer numero * @ORM\Column(type="integer", nullable=false) * @Assert\NotBlank(message="Veuillez donner un numéro à ce sous-domaine") * @Assert\Type(type="integer", message="Le numéro doit être un nombre") */ protected $numero; /** * @Gedmo\Slug(fields={"nom"}) * @ORM\Column(length=128, unique=true) */ protected $slug; /** * @Gedmo\Timestampable(on="create") * @ORM\Column(type="datetime") */ protected $created; /** * @Gedmo\Timestampable(on="update") * @ORM\Column(type="datetime") */ protected $updated; /** * @ORM\Column(name="deleted_at", type="datetime", nullable=true) */ protected $deletedAt; /** * @ORM\ManyToOne(targetEntity="Domaine", inversedBy="sousDomaines") * @ORM\JoinColumn(name="domaine_id", referencedColumnName="id") */ protected $domaine; /** * @var ArrayCollection formacodes * @ORM\ManyToMany(targetEntity="Formacode") * @ORM\JoinTable(name="gbot_sousDomaines_formacodes", * joinColumns={@ORM\JoinColumn(name="sousdomaine_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="formacode_id", referencedColumnName="id")} * ) */ protected $formacodes; /** * * @var ArrayCollection codesRome * @ORM\ManyToMany(targetEntity="CodeRome") * @ORM\JoinTable(name="gbot_sousDomaines_codesRomes", * joinColumns={@ORM\JoinColumn(name="sousdomaine_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="coderome_id", referencedColumnName="id")} * ) */ protected $codesRome; /** * * @var ArrayCollection codesNsf * @ORM\ManyToMany(targetEntity="CodeNsf") * @ORM\JoinTable(name="gbot_sousDomaines_codesNsf", * joinColumns={@ORM\JoinColumn(name="sousdomaine_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="codensf_id", referencedColumnName="id")} * ) */ protected $codesNsf; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set domaine * * @param ****\****\Entity\Domaine $domaine */ public function setDomaine(\****\****\Entity\Domaine $domaine) { $this->domaine = $domaine; } /** * Get domaine * * @return ****\****\Entity\Domaine */ public function getDomaine() { return $this->domaine; } public function __construct() { $this->formacodes = new \Doctrine\Common\Collections\ArrayCollection(); $this->codesRome = new \Doctrine\Common\Collections\ArrayCollection(); $this->codesNsf = new \Doctrine\Common\Collections\ArrayCollection(); } /** * Add formacodes * * @param ****\****\Entity\Formacode $formacodes */ public function addFormacode(\AcDijon\GretabotBundle\Entity\Formacode $formacodes) { $this->formacodes[] = $formacodes; } /** * Get formacodes * * @return Doctrine\Common\Collections\Collection */ public function getFormacodes() { return $this->formacodes; } /** * Set slug * * @param string $slug */ public function setSlug($slug) { $this->slug = $slug; } /** * Get slug * * @return string */ public function getSlug() { return $this->slug; } /** * Set created * * @param datetime $created */ public function setCreated($created) { $this->created = $created; } /** * Get created * * @return datetime */ public function getCreated() { return $this->created; } /** * Set updated * * @param datetime $updated */ public function setUpdated($updated) { $this->updated = $updated; } /** * Get updated * * @return datetime */ public function getUpdated() { return $this->updated; } /** * Set deletedAt * * @param datetime $deletedAt */ public function setDeletedAt($deletedAt) { $this->deletedAt = $deletedAt; } /** * Get deletedAt * * @return datetime */ public function getDeletedAt() { return $this->deletedAt; } /** * Set nom * * @param string $nom */ public function setNom($nom) { $this->nom = $nom; } /** * Get nom * * @return string */ public function getNom() { return $this->nom; } /** * Add codesRome * * @param ****\****\Entity\CodeRome $codesRome */ public function addCodeRome(\AcDijon\GretabotBundle\Entity\CodeRome $codesRome) { $this->codesRome[] = $codesRome; } /** * Get codesRome * * @return Doctrine\Common\Collections\Collection */ public function getCodesRome() { return $this->codesRome; } /** * Add codesNsf * * @param ****\****\Entity\CodeNsf $codesNsf */ public function addCodeNsf(\****\****\Entity\CodeNsf $codesNsf) { $this->codesNsf[] = $codesNsf; } /** * Get codesNsf * * @return Doctrine\Common\Collections\Collection */ public function getCodesNsf() { return $this->codesNsf; } /** * Set numero * * @param integer $numero */ public function setNumero($numero) { $this->numero = $numero; } /** * Get numero * * @return integer */ public function getNumero() { return $this->numero; } }
Le repository :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 public function indexAction() { $sousdomaines = $this->getDoctrine()->getRepository('AcDijonGretabotBundle:SousDomaine')->findAllOrderedByName(); return array('sousdomaines', $sousdomaines); }
Je ne sais pas trop comment poser ma question car je ne comprends ce problème. Mais si quelqu'un a une idée, il m'aiderait bien.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 class SousDomaineRepository extends EntityRepository { public function findAllOrderedByName() { $query = $this->createQueryBuilder('p') ->orderBy("p.nom", "ASC") ->getQuery(); return $query->getResult(); } }
Merci d'avance
Partager