2017 © Pedro PelĂĄez
 

library datetime-immutable

DateTimeImmutable as a type for Doctrine - abandoned as doctrine/dba already implement this

image

doctrineum/datetime-immutable

DateTimeImmutable as a type for Doctrine - abandoned as doctrine/dba already implement this

  • Wednesday, July 18, 2018
  • by jaroslavtyc
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,457 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Test Coverage License, (*1)

Deprecated

Use Doctrine\DBAL\Types\DateTimeImmuable instead., (*2)

Do you need it?

  • first of all, think twice if you need a new type into your application
  • on the other side, immutable object of any time can save you a lot of problems and time...

Usage

  • register it
\Doctrineum\DateTimeImmutable\DateTimeImmutableType::registerSelf();
  • use it
use Doctrine\ORM\Mapping as ORM;

class Foo {
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue
     */
    private $id;
    /**
     * @ORM\Column(type="datetime-immutable")
     */
    private $when;

    public function __construct(\DateTimeImmutable $when)
    {
        $this->when = $when;
    }
}
\Doctrineum\DateTimeImmutable\DateTimeImmutableType::registerSelf();

$foo = new Foo(new \DateTimeImmutable());
// ...
$entityManager->persist($foo);
$entityManager->flush();

Common pitfalls

Be aware of timezone which is not persisted and therefore can not be restored on fetch. Doctrine uses server default timezone for it. For details and most of all, for solution, see Doctrine docs, (*3)

The Versions

18/07 2018

dev-master

9999999-dev

DateTimeImmutable as a type for Doctrine - abandoned as doctrine/dba already implement this

  Sources   Download

MIT

The Requires

 

The Development Requires

doctrine datetime immutable

18/07 2018

2.1.x-dev

2.1.9999999.9999999-dev

DateTimeImmutable as a type for Doctrine - abandoned as doctrine/dba already implement this

  Sources   Download

MIT

The Requires

 

The Development Requires

doctrine datetime immutable

18/07 2018

2.1.0

2.1.0.0

DateTimeImmutable as a type for Doctrine - abandoned as doctrine/dba already implement this

  Sources   Download

MIT

The Requires

 

The Development Requires

doctrine datetime immutable

19/02 2017

2.0.x-dev

2.0.9999999.9999999-dev

DateTimeImmutable as a type for Doctrine

  Sources   Download

MIT

The Requires

 

The Development Requires

doctrine datetime immutable

19/02 2017

2.0.0

2.0.0.0

DateTimeImmutable as a type for Doctrine

  Sources   Download

MIT

The Requires

 

The Development Requires

doctrine datetime immutable

19/02 2017

1.0.x-dev

1.0.9999999.9999999-dev

DateTimeImmutable as a type for Doctrine

  Sources   Download

MIT

The Requires

 

The Development Requires

doctrine datetime immutable

19/02 2017

1.0.0

1.0.0.0

DateTimeImmutable as a type for Doctrine

  Sources   Download

MIT

The Requires

 

The Development Requires

doctrine datetime immutable