salut, en fait j'ai un problème pour intégrer le CalendarBundle:
https://github.com/robzienert/CalendarBundle
J'ai des problèmes avec la classe Calendar qui merdouille donc les classes:
Là c'est l'entité à laquelle j'ai rajouté les méthodes:
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 <?php namespace Rizza\CalendarBundle\Entity; use Rizza\CalendarBundle\Model\Calendar as AbstractCalendar; abstract class Calendar extends AbstractCalendar { protected $id; protected $owner; /** * @validation\MaxLength(255) * @validation\NotBlank() */ protected $name; protected $events; protected $visibility; public function getId() { return $this->id; } public function setName($name) { $this->name = $name; } public function getName() { return $this->name; } public function getEvents() { return $this->events ?: $this->events = new ArrayCollection(); } public function getEventsOnDay(\DateTime $dateTime) { /** @var $event Event */ $p = function ($event) use ($dateTime) { return $event->isOnDate($dateTime); }; return $this->getEvents()->filter($p); } public function addEvent(EventInterface $event) { if (!$this->getEvents()->contains($event)) { $this->getEvents()->add($event); } } public function removeEvent(EventInterface $event) { if ($this->getEvents()->contains($event)) { $this->getEvents()->removeElement($event); } } public function __toString() { return $this->getName(); } public function setVisibility($visibility) { $this->visibility = $visibility; } public function getVisibility() { return $this->visibility; } public function isPublic() { return $this->visibility === CalendarInterface::VISIBILITY_PUBLIC; } public function isPrivate() { return $this->visibility === CalendarInterface::VISIBILITY_PRIVATE; } }
Là c'est Model/Calendar:
et là c'est l'interface
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 <?php namespace Rizza\CalendarBundle\Model; use Doctrine\Common\Collections\ArrayCollection; use Rizza\CalendarBundle\Model\EventInterface; use Symfony\Component\Validator\Constraints as validation; use Symfony\Component\Security\Core\User\UserInterface; abstract class Calendar implements CalendarInterface { protected $id; protected $owner; /** * @validation\MaxLength(255) * @validation\NotBlank() */ protected $name; protected $events; protected $visibility; public function getId() { return $this->id; } public function setOwner(UserInterface $owner) { $this->owner = $owner; } public function getOwner() { return $this->owner; } public function setName($name) { $this->name = $name; } public function getName() { return $this->name; } public function getEvents() { return $this->events ?: $this->events = new ArrayCollection(); } public function getEventsOnDay(\DateTime $dateTime) { /** @var $event Event */ $p = function ($event) use ($dateTime) { return $event->isOnDate($dateTime); }; return $this->getEvents()->filter($p); } public function addEvent(EventInterface $event) { if (!$this->getEvents()->contains($event)) { $this->getEvents()->add($event); } } public function removeEvent(EventInterface $event) { if ($this->getEvents()->contains($event)) { $this->getEvents()->removeElement($event); } } public function __toString() { return $this->getName(); } public function setVisibility($visibility) { $this->visibility = $visibility; } public function getVisibility() { return $this->visibility; } public function isPublic() { return $this->visibility === CalendarInterface::VISIBILITY_PUBLIC; } public function isPrivate() { return $this->visibility === CalendarInterface::VISIBILITY_PRIVATE; } } </code></secret>
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 namespace Rizza\CalendarBundle\Model; use Symfony\Component\Security\Core\User\UserInterface; interface CalendarInterface { const VISIBILITY_PUBLIC = 1; const VISIBILITY_PRIVATE = 2; /** * Returns the ID of the calendar. * * @return int */ public function getId(); /** * Set the owner user of the calendar. * * @param UserInterface $owner */ public function setOwner(UserInterface $owner); /** * Get the owner user of the calendar. * * @return UserInterface */ public function getOwner(); /** * Set the name of the calendar. * * @param string $name */ public function setName($name); /** * Get the name of the calendar. * * @return string */ public function getName(); /** * Get the associated events with this calendar. * * @return ArrayCollection */ public function getEvents(); /** * Get all associated events that fall on a given day. * * @return ArrayCollection */ public function getEventsOnDay(\DateTime $dateTime); /** * Add an event to the calendar. * * @param EventInterface $event */ public function addEvent(EventInterface $event); /** * Remove an event from the calendar. * * @param EventInterface $event */ public function removeEvent(EventInterface $event); /** * Set the visibility of the calendar. * * @param integer $visibility */ public function setVisibility($visibility); /** * Get the visibility of the calendar. */ public function getVisibility(); /** * Whether the calendar is public. */ public function isPublic(); /** * Whether the calendar is private. */ public function isPrivate(); }
Et là j'ai eu cette erreur là en faisant un --dump-sql pour faire l'update de mon schéma
Fatal error: Declaration of Rizza\CalendarBundle\Entity\Calendar::setOwner() must be compatible with that of Rizza\CalendarBundle\Model\CalendarInterface::setOwner() in C:\Program Files\Zend\Apache2\htdocs\Projet\src\Rizza\CalendarBundle\Entity\Calendar.php on line 8
L'entité Calendar est persistée par ce fichier xml:
J'ai aussi trouvé celui là mais je sais pas lequel est utilisé :S :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <mapped-superclass name="Rizza\CalendarBundle\Entity\Calendar"> <field name="name" column="name" type="string" length="255" /> <field name="visibility" column="visibility" type="integer" /> </mapped-superclass> </doctrine-mapping>
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<?xml version="1.0" encoding="UTF-8"?> <doctrine-mongo-mapping xmlns="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping.xsd"> <document name="Rizza\CalendarBundle\Document\Calendar" table="calendar_calendar"> <field name="id" id="true"/> <field name="name" fieldName="name" type="string" /> <reference-many name="events" fieldName="events" target-document="Rizza\CalendarBundle\Document\Events" /> </document> </doctrine-mongo-mapping>
Mais aucun des fichiers ne contient le owner j'l'ai donc enlevé des classes Calendar mais j'ai eu cette erreur concernant la méthode addEvent:
<secret><erreur>Fatal error: Declaration of Rizza\CalendarBundle\Entity\Calendar::addEvent() must be compatible with that of Rizza\CalendarBundle\Model\CalendarInterface::addEvent() in C:\ProgramFiles\Zend\Apache2\htdocs\Projet\src\Rizza\CalendarBundle\Entity\Calendar.php on line 8</erreur></secret>
Je sais pas si c'est clair mais en tout cas je suis perdu :euh:
Partager