PHP code example of tourze / doctrine-timestamp-bundle
1. Go to this page and download the library: Download tourze/doctrine-timestamp-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tourze / doctrine-timestamp-bundle example snippets
use Tourze\DoctrineTimestampBundle\Attribute\CreateTimeColumn;
use Tourze\DoctrineTimestampBundle\Attribute\UpdateTimeColumn;
use Tourze\DoctrineTimestampBundle\Enum\Types;
class YourEntity
{
#[CreateTimeColumn(type: Types::datetime)]
private DateTime $createdAt;
#[UpdateTimeColumn(type: Types::timestamp)]
private int $updatedAt;
}
use Tourze\DoctrineTimestampBundle\Traits\CreateTimeAware;
use Tourze\DoctrineTimestampBundle\Traits\TimestampableAware;
// Only creation timestamp
class ReadOnlyEntity
{
use CreateTimeAware;
// Provides: $createTime property with getter/setter
}
// Both creation and update timestamps
class MutableEntity
{
use TimestampableAware;
// Provides: $createTime and $updateTime properties with getters/setters
// Also
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.