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
Requires
- php: >=7.1.3
- doctrine/orm: ^2.5
- symfony/config: ^4.0
- symfony/dependency-injection: ^4.0
- symfony/event-dispatcher: ^4.0
- symfony/framework-bundle: ^4.0
- symfony/http-kernel: ^4.0
- symfony/validator: ^4.0
Requires (Dev)
README
Helper methods and properties for timestamping Doctrine2 entities.
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.