créer un évènement

Default
,

bonjour,

j'ai utilisé le adisigns calender bundle https://github.com/adesigns/calendar-bundle aprés l'affichage de calendrier j'ai voulu créer un évènement en suivant l'exemple du bundle voici le listner et le service.xml.Est ce que je dois mettre autre chose dans le controleur ou nn puisque ça fonctionne pas

[code] <?php

namespace Ecommerce\BlogBundle\EventListener;

use ADesigns\CalendarBundle\Event\CalendarEvent;
use ADesigns\CalendarBundle\Entity\EventEntity;
use Doctrine\ORM\EntityManager;
use Ecommerce\BlogBundle\Entity\Produit;

class CalendarEventListener
{
private $entityManager;

public function __construct(EntityManager $entityManager)
{
    $this->entityManager = $entityManager;
}

public function loadEvents(CalendarEvent $calendarEvent)
{
    $startDate = $calendarEvent->getStartDatetime();
    $endDate = $calendarEvent->getEndDatetime();

    // The original request so you can get filters from the calendar
    // Use the filter in your query for example

    $request = $calendarEvent->getRequest();
    $filter = $request->get('filter');


    // load events using your custom logic here,
    // for instance, retrieving events from a repository

    $companyEvents = $this->entityManager->getRepository('EcommerceBlogBundle:Produit')
                      ->createQueryBuilder('c')
                      ->where('c.event_datetime BETWEEN :startDate and :endDate')
                      ->setParameter('startDate', $startDate->format('Y-m-d H:i:s'))
                      ->setParameter('endDate', $endDate->format('Y-m-d H:i:s'))
                      ->getQuery()->getResult();
                                      var_dump($companyEvent);


    // $companyEvents and $companyEvent in this example
    // represent entities from your database, NOT instances of EventEntity
    // within this bundle.
    //
    // Create EventEntity instances and populate it's properties with data
    // from your own entities/database values.

    foreach($companyEvents as $companyEvent) {

        // create an event with a start/end time, or an all day event
        if ($companyEvent->getAllDayEvent() === false) {
            $eventEntity = new EventEntity($companyEvent->getnomProduit(), $companyEvent->getStartDatetime(), $companyEvent->getEndDatetime());
            var_dump($companyEvent);
        } else {
            $eventEntity = new EventEntity($companyEvent->getnomProduit(), $companyEvent->getStartDatetime(), null, true);
                            var_dump($companyEvent);

        }

        //optional calendar event settings
      $eventEntity->setAllDay(true); // default is false, set to true if this is an all day event
        $eventEntity->setBgColor('#FF0000'); //set the background color of the event's label
        $eventEntity->setFgColor('#FFFFFF'); //set the foreground color of the event's label
        $eventEntity->setUrl('http://www.google.com'); // url to send user to when event label is clicked
        $eventEntity->setCssClass('my-custom-class'); // a custom class you may want to apply to event labels

        //finally, add the event to the CalendarEvent for displaying on the calendar
        $calendarEvent->addEvent($eventEntity);
    }
}

}[/code]

[code] <?xml version="1.0" ?>

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
    <service id="ecommerce.blogbundle.calendar_listener" class="Ecommerce\BlogBundle\EventListener\CalendarEventListener">
        <argument type="service" id="doctrine.orm.entity_manager" />
        <tag name="kernel.event_listener" event="calendar.load_events" method="loadEvents" />
    </service>

</services>

[/code]