fresh/timestampable-entity-bundle

此包已被弃用,不再维护。未建议替代包。

用于对 Doctrine2 实体进行时间戳标记的辅助方法和属性。

安装: 801

依赖项: 0

建议者: 0

安全性: 0

类型:symfony-bundle

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

This package is auto-updated.

Last update: 2022-02-01 12:29:24 UTC


README

用于对 Doctrine2 实体进行时间戳标记的辅助方法和属性。

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

SensioLabsInsight knpbundles.com

通过 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.