TimestampableEntityBundle
Helper methods and properties for timestamping Doctrine2 entities.
Install via Composer
composer req fresh/timestampable-entity-bundle
Usage
Create Player entity that implements TimestampableInterface and use trait TimestampableTrait.
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Fresh\TimestampableEntityBundle\Model\TimestampableInterface;
use Fresh\TimestampableEntityBundle\Traits\TimestampableTrait;
/**
* Player Entity.
*
* @ORM\Entity()
* @ORM\Table(name="players")
*/
class Player implements TimestampableInterface
{
use TimestampableTrait;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
}Now Player entity has properties createdAt and updatedAt which come from TimestampableTrait.
There are also setters and getters for them.
Contributing
See CONTRIBUTING file.
