PHP code example of andanteproject / period-bundle
1. Go to this page and download the library: Download andanteproject/period-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/ */
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use League\Period\Duration;
use League\Period\Period;
use League\Period\Sequence;
/**
* @ORM\Entity()
*/
class Meeting
{
/**
* @ORM\Column(type="period", nullable=true)
*/
private ?Period $period = null;
/**
* @ORM\Column(type="duration", nullable=true)
*/
private ?Duration $duration = null;
/**
* @ORM\Column(type="sequence", nullable=true)
*/
private ?Sequence $sequence = null;
}
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use League\Period\Period;
/**
* @ORM\Entity()
*/
class Meeting
{
/**
* @ORM\Embedded(class="League\Period\Period", columnPrefix="period_")
*/
private ?Period $period = null;
}
declare(strict_types=1);
use Andante\PeriodBundle\Form\PeriodType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\FormBuilderInterface;
class EventType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', Type\TextType::class)
->add('period', PeriodType::class)
;
}
}