PHP code example of specshaper / calendar-bundle

1. Go to this page and download the library: Download specshaper/calendar-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

specshaper / calendar-bundle example snippets



// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new SpecShaper\CalendarBundle\SpecShaperCalendarBundle(),
        );
        // ...
    }
    // ...
}



/**
 * AppBundle\Entity\Calendar.php
 * 
 * @copyright  (c) 2016, SpecShaper - All rights reserved
 */

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use AppBundle\Entity\CalendarEvent;
use SpecShaper\CalendarBundle\Model\Calendar as BaseCalendar;

/**
 * A calendar entity to house information on the calendar container itself.
 * 
 * The class extends the model class in the SpecShaperCalendarBundle. See link.
 * 
 * @link    https://github.com/mogilvie/CalendarBundle/blob/master/Model/Calendar.php
 * @author  Mark Ogilvie <[email protected]>
 * 
 * @ORM\Table(name="calendar_calendar")
 * @ORM\Entity
 */
class Calendar extends BaseCalendar {
    // Add your own relationships and properties here...

    /**
     * The events that belong in this Calendar.
     * 
     * Required by SpecShaperCalendarBundle.
     * 
     * @ORM\ManyToMany(targetEntity="CalendarEvent", mappedBy="calendar")
     */
    protected $calendarEvents;

    /**
     * Constructor.
     * 
     * Required by SpecShaperCalendarBundle to call the parent constructor on the
     * mapped superclass.
     * 
     * Modify to suit your needs.
     */
    public function __construct() {
        parent::__construct();
    }


}




/**
 * AppBundle\Entity\CalendarEvent.php
 * 
 * @author     Written by Mark Ogilvie <[email protected]>, 1 2016
 */

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use AppBundle\Entity\CalendarAttendee;
use AppBundle\Entity\CalendarComment;
use AppBundle\Entity\Calendar;
use Symfony\Component\Validator\Constraints\Valid;
use SpecShaper\CalendarBundle\Model\CalendarEvent as BaseEvent;
use AppBundle\Entity\CalendarReoccurance;

/**
 * A CalendarEvent is an appointment/meeting etc belonging to a Calendar.
 * 
 * Be wary of confusion between a CalendarEvent entity and a thown events.
 *
 * @link    https://github.com/mogilvie/CalendarBundle/blob/master/Model/CalendarComment.php
 * @author  Mark Ogilvie <[email protected]>
 * 
 * @ORM\Table(name="calendar_event")
 * @ORM\Entity
 */
class CalendarEvent extends BaseEvent
{

    /**
     * The calendar that this event belongs in.
     * 
     * Required by SpecShaperCalendarBundle.
     * 
     * @ORM\ManyToMany(targetEntity="Calendar", inversedBy="calendarEvents")
     */
    protected $calendar;
    
    /**
     * The people invited to this event.
     * 
     * Required by SpecShaperCalendarBundle.
     * 
     * @Valid
     * @ORM\OneToMany(targetEntity="CalendarAttendee", mappedBy="calendarEvent", cascade={"persist", "remove"})
     */
    protected $calendarAttendees;
    
    /**
     * Comments posted in response to this event.
     * 
     * Required by SpecShaperCalendarBundle.
     * 
     * @Valid
     * @ORM\OneToMany(targetEntity="CalendarComment", mappedBy="calendarEvent", cascade={"persist", "remove"})
     */
    protected $calendarComments;
    
    /**
     * Comments posted in response to this event.
     * 
     * Required by SpecShaperCalendarBundle.
     * 
     * @Valid
     * @ORM\ManyToOne(targetEntity="CalendarReoccurance", inversedBy="calendarEvent", cascade={"persist", "remove"})
     */
    protected $calendarReoccurance;
        
    /**
     * Constructor.
     * 
     * Required by SpecShaperCalendarBundle to call the parent constructor on the
     * mapped superclass.
     * 
     * Note that constructor for the arrays defined in this entity are already in the
     * parent mapped superclass construct and do not need to be created here.
     * 
     * Modify to suit your needs.
     */
    public function __construct()
    {
       parent::__construct();   
    }
    
    // Add your own relationships and properties below here..

}



/**
 * AppBundle\Entity\CalendarEvent.php
 * 
 * @author     Written by Mark Ogilvie <[email protected]>, 1 2016
 */

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use AppBundle\Entity\CalendarAttendee;
use AppBundle\Entity\CalendarComment;
use AppBundle\Entity\Calendar;
use SpecShaper\CalendarBundle\Model\CalendarReoccurance as BaseReoccurance;

/**
 *
 * @link    https://github.com/mogilvie/CalendarBundle/blob/master/Model/CalendarComment.php
 * @author  Mark Ogilvie <[email protected]>
 * 
 * @ORM\Table(name="calendar_reoccurance")
 * @ORM\Entity
 */
class CalendarReoccurance extends BaseReoccurance
{
    /**
     * @ORM\OneToMany(targetEntity="CalendarEvent", mappedBy="calendarReoccurance")
     */
    protected $calendarEvents;
        
    /**
     * Constructor.
     * 
     * Required by SpecShaperCalendarBundle to call the parent constructor on the
     * mapped superclass.
     * 
     * Note that constructor for the arrays defined in this entity are already in the
     * parent mapped superclass construct and do not need to be created here.
     * 
     * Modify to suit your needs.
     */
    public function __construct()
    {
       parent::__construct();        
    }
    
    // Add your own relationships and properties below here..
   

}




/**
 * AppBundle\Entity\CalendarAttendee.php
 * 
 * @author     Written by Mark Ogilvie <[email protected]>, 1 2016
 */
namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use AppBundle\Entity\CalendarEvent;
use SpecShaper\CalendarBundle\Model\CalendarAttendee as BaseAttendee;

/**
 * A CalendarAttendee is a entity who has been invited to a CalendarEvent.
 * 
 * The class holds information relating to the status of the invitation.
 *
 * @link    https://github.com/mogilvie/CalendarBundle/blob/master/Model/CalendarAttendee.php
 * @author  Mark Ogilvie <[email protected]>
 * 
 * @ORM\Table(name="calendar_attendee")
 * @ORM\Entity
 */
class CalendarAttendee extends BaseAttendee
{
    /**
     * The calendar that this event belongs in.
     * 
     * Required by SpecShaperCalendarBundle.
     * 
     * @ORM\ManyToOne(targetEntity="CalendarEvent", inversedBy="calendarAttendees")
     */
    protected $calendarEvent;
//    
//    /**
//     * Constructor.
//     * 
//     * Required by SpecShaperCalendarBundle to call the parent constructor on the
//     * mapped superclass.
//     * 
//     * Modify to suit your needs.
//     */
//    public function __construct()
//    {
//        parent::__construct();
//    }
    
    // Add your own relationships and properties below here..
}




/**
 * AppBundle\Entity\CalendarComment.php
 * 
 * @author     Written by Mark Ogilvie <[email protected]>, 1 2016
 */
namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use AppBundle\Entity\CalendarEvent;
use SpecShaper\CalendarBundle\Model\CalendarComment as BaseComment;

/**
 * Calendar comments are messages left on the CalendarEvent.
 *
 * @link    https://github.com/mogilvie/CalendarBundle/blob/master/Model/CalendarComment.php
 * @author  Mark Ogilvie <[email protected]>
 * 
 * @ORM\Table(name="calendar_comment")
 * @ORM\Entity 
 */
class CalendarComment extends BaseComment
{
    /**
     * The calendar that this event belongs in.
     * 
     * Required by SpecShaperCalendarBundle.
     * 
     * @ORM\ManyToOne(targetEntity="CalendarEvent", inversedBy="calendarAttendees")
     */
    protected $calendarEvent;
    
    /**
     * Constructor.
     * 
     * Required by SpecShaperCalendarBundle to call the parent constructor on the
     * mapped superclass.
     * 
     * Modify to suit your needs.
     */
    public function __construct()
    {
        parent::__construct();
    }
    
    // Add your own relationships and properties below here..


}