fresh/timestampable-entity-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Helper methods and properties for timestamping Doctrine2 entities.

v2.0.0 2017-12-10 18:59 UTC

README

Helper methods and properties for timestamping Doctrine2 entities.

Scrutinizer Quality Score Build Status CodeCov License Latest Stable Version Total Downloads StyleCI Gitter

SensioLabsInsight knpbundles.com

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.