dev-master
9999999-devProvides all planning methods for integration in Symfony 3
MIT
The Requires
Provides all planning methods for integration in Symfony 3
Provides all planning methods for integration in Symfony 3, (*1)
$ composer require roshyo/planning-bundle
<?php // app/AppKernel.php public function registerBundles() { ..., new Roshyo\PlanningBundle\RoshyoPlanningBundle(), ..., }
# app/config.yml ... roshyo_planning: resources: resource_name: class: 'YourNamespace\YourClass' items: - 'method' - 'method1.method2'
the resource_name can be anything, like employee, customer, doctor, etc..., (*2)
the class in class section must extend "Roshyo\PlanningBundle\Calendar\Resources", (*3)
<?php // src/AppBundle/Entity/Employee.php namespace AppBundle\Entity; use Roshyo\PlanningBundle\Calendar\Resources\Resource; class Employee extends Resource { ...
Then you can define your fields as usual, and you can map with Doctrine by overriding them or in yml, xml..., (*4)
Items in item section are a bit more tricky. You have to define which methods return items for the resource. For example, I define :, (*5)
# app/config.yml ... roshyo_planning: resources: resource_name: class: 'AppBundle\Entity\Employee' items: - 'meetings' - 'daysOff.dayOff'
Then, there are two different items for my Resource : Employee::getMeetings() returning an array of Items, and Employee::getDaysOff() which returns an array of items with method DayOff::getDayOff(). This second one allows to mark as Item a linked Entity., (*6)
The employee must now have at least :, (*7)
<?php // src/AppBundle/Entity/Employee.php namespace AppBundle\Entity; use Roshyo\PlanningBundle\Calendar\Resources\Resource; class Employee extends Resource { /** * @return \Roshyo\PlanningBundle\Calendar\Items\Item[] */ public function getMeetings(){} /** * @return array|ArrayCollection|EmployeeDayOff[] */ public function getDaysOff(){} ...
And the Items:, (*8)
<?php // src/AppBundle/Entity/Meeting.php namespace AppBundle\Entity; use Roshyo\PlanningBundle\Calendar\Items\Item; class Meeting extends Item { ...
<?php // src/AppBundle/Entity/EmployeeDayOff.php namespace AppBundle\Entity; class EmployeeDayOff { /** * @return DayOff */ public function getDayOff(){} ...
<?php // src/AppBundle/Entity/DayOff.php namespace AppBundle\Entity; use Roshyo\PlanningBundle\Calendar\Items\Item; class DayOff extends Item { ...
Provides all planning methods for integration in Symfony 3
MIT