Use CalendR inside your Symfony2 application via FrequenceWebCalendRBundle
You can install it with composer (frequence-web/calendr-bundle
), git submodule, or Symfony2.0 deps
file.
Then, juste add the bundle to your AppKernelClass
.
<?php
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// Your bundles
new FrequenceWeb\Bundle\CalendRBundle\FrequenceWebCalendRBundle(),
);
return $bundles;
}
}
The CalendR bundle register the CalendR factory into the Symfony2 DIC. You can access it everywhere by requesting the
calendr
service.
To add your event provider to the CalendR event manager, you have to declare it as a service, and mark it with the
calendr.event_provider
tag.
services:
my_awesome_event_provider:
class: Vendor\MyAwesomeEventProvider
tags:
- { name: calendr.event_provider }
For Doctrine2 repositories, wich are instantied by the EntityManager, you have to declare the service via
factory_service
and factory_method
.
services:
booking_repository:
class: Your\Bundle\Entity\EventRepository
factory_service: doctrine.orm.default_entity_manager
factory_method: getRepository
arguments: ['YourEntity:ShortName']
tags:
- { name: calendr.event_provider }
If you’re using Twig with Symfony2, the CalendR Twig extension will be automatically registered. See Twig integration.