PHP code example of kami / booking-bundle

1. Go to this page and download the library: Download kami/booking-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/ */

    

kami / booking-bundle example snippets




// app/AppKernel.php


public function registerBundles()
{
    $bundles = array(
        // ...

        new Kami\BookingBundle\KamiBookingBundle(),
    );
}



namespace Vendor\Bundle\Entity;

use Kami\BookingBundle\Entity\Booking as BaseClass;

/**
 * Booking
 *
 * @ORM\Entity()
 * @ORM\Table(name="booking")
 */
class Booking extends BaseClass
{
    /**
         * @var integer
         *
         * @ORM\Column(name="id", type="integer")
         * @ORM\Id
         * @ORM\GeneratedValue(strategy="AUTO")
         */
        protected $id;

        /**
         * @var \Vendor\Bundle\Entity\BookableItem
         *
         * @ORM\ManyToOne(targetEntity="BookableItem", inversedBy="bookings")
         * @ORM\JoinColumn(name="property_id", referencedColumnName="id")
         */
        protected $item;

        // Don't forget about getters and setters
}




public function bookingAction()
{
    $this->get('booker'); /** @var \Kami\BookingBundle\Helper\Booker */
}
bash
$ php composer.phar 
 isAvailableForPeriod($item, \DateTime $start, \DateTime $end) 
 whereAvailableForPeriod(QueryBuilder $queryBuilder, $join, \DateTime $start, \DateTime $end)
 book($item, \DateTime $start, \DateTime $end) 
Entity | false