dev-master
9999999-devA set of minimalistic Doctrine 2 ORM extensions.
MIT
The Requires
- php >=5.4.0
- doctrine/orm >=2.3.0
Wallogit.com
2017 © Pedro Peláez
A set of minimalistic Doctrine 2 ORM extensions.
This library aims to be a minimalistic set of Doctrine 2 ORM extensions for php >=5.4. I'm developing this library for a project in my company. I am using it in production. The API is in no way stable(yet). More extensions will be added. I will try to keep the docs updated. Any help will be appreciated., (*1)
First you must register the timestampable event listener:, (*2)
``` php, (*3)
<?php, (*4)
use V3labs\DoctrineExtensions\ORM\Timestampable\TimestampableListener;, (*5)
// ..., (*6)
$em->getEventManager()->addEventSubscriber(new TimestampableListener);, (*7)
If you are a Symfony2 user you can add this to your config.yaml: ``` yaml services: v3labs.doctrine_extensions.timestampable_listener: class: "V3labs\DoctrineExtensions\ORM\Timestampable\TimestampableListener" public: false tags: - { name: doctrine.event_subscriber }
An entity using this extension would loke like this:, (*8)
``` php <?php, (*9)
namespace Some\Namespace;, (*10)
use Doctrine\ORM\Mapping as ORM; use V3labs\DoctrineExtensions\ORM\Timestampable\Timestampable;, (*11)
/** * Event * * @ORM\Table() * @ORM\Entity */ class Event { use Timestampable;, (*12)
// Rest of your entity
}, (*13)
```, (*14)
A set of minimalistic Doctrine 2 ORM extensions.
MIT