1. Go to this page and download the library: Download franzose/doctrine-chronos 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/ */
franzose / doctrine-chronos example snippets
// in the bootstrapping code
use Doctrine\DBAL\Types\Type;
use Franzose\DoctrineChronos\ChronosDateType;
use Franzose\DoctrineChronos\ChronosTimeType;
use Franzose\DoctrineChronos\ChronosType;
use Franzose\DoctrineChronos\ChronosTzType;
Type::addType('chronos_date', ChronosDateType::class);
Type::addType('chronos_time', ChronosTimeType::class);
Type::addType('chronos', ChronosType::class);
Type::addType('chronostz', ChronosTzType::class);
declare(strict_types=1);
use Cake\Chronos\Chronos;
use Cake\Chronos\ChronosDate;
use Cake\Chronos\ChronosTime;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;
#[Entity, Table(name: '"user"')]
class User
{
#[Column(name: 'registered_at', type: 'chronostz', nullable: false)]
private Chronos $registeredAt;
#[Column(name: 'confirmed_at', type: 'chronostz')]
private ?Chronos $confirmedAt = null;
#[Column(name: 'deactivated_at', type: 'chronostz')]
private ?Chronos $deactivatedAt = null;
#[Column(name: 'birth_date', type: 'chronos_date')]
private ?ChronosDate $birthDate = null;
#[Column(name: 'usual_wake_up', type: 'chronos_time')]
private ?ChronosTime $usualWakeUp = null;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.