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

This package is auto-updated.

Last update: 2019-02-20 19:37:10 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


## Usage

Create `Player` entity that implements `TimestampableInterface` and use trait `TimestampableTrait`.

```php
<?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](https://github.com/fre5h/TimestampableEntityBundle/blob/master/.github/CONTRIBUTING.md) file.