Skip to content

Commit

Permalink
Add timastampable behaviour for Post entities
Browse files Browse the repository at this point in the history
  • Loading branch information
bocharsky-bw committed Jun 23, 2016
1 parent c0ccb1d commit 408bc11
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function registerBundles()
new AppBundle\AppBundle(),

new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
];

if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
Expand Down
6 changes: 6 additions & 0 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@ doctrine_migrations:
namespace: Application\Migrations
table_name: migration_versions
name: Application Migrations

stof_doctrine_extensions:
default_locale: en_US
orm:
default:
timestampable: true
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",

"doctrine/doctrine-migrations-bundle": "^1.1"
"doctrine/doctrine-migrations-bundle": "^1.1",
"stof/doctrine-extensions-bundle": "^1.2"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
Expand Down
184 changes: 182 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/AppBundle/Entity/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;

/**
* Post
Expand All @@ -12,6 +13,12 @@
*/
class Post
{
/**
* Hook timestampable behavior
* updates createdAt, updatedAt fields
*/
use TimestampableEntity;

/**
* @var int
*
Expand Down

0 comments on commit 408bc11

Please sign in to comment.