2017 © Pedro PelĂĄez
 

symfony-bundle planning-bundle

Provides all planning methods for integration in Symfony 3

image

roshyo/planning-bundle

Provides all planning methods for integration in Symfony 3

  • Tuesday, November 7, 2017
  • by Roshyo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PlanningBundle

Provides all planning methods for integration in Symfony 3, (*1)

Installation

$ composer require roshyo/planning-bundle

Configuration

<?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
{
  ...

The Versions

07/11 2017

dev-master

9999999-dev

Provides all planning methods for integration in Symfony 3

  Sources   Download

MIT

The Requires