webforge/symfony

1.5.0 2017-06-12 09:09 UTC

README

A bridge for webforge and symfony with the usual suspects

Use the DateTimeHandler

composer require webforge/symfony

add to your config.yml/services.yml from symfony:

imports:
    - { resource: '../../vendor/webforge/symfony/Resources/config/services.yml' }

when you're using the webforge/doctrine-compiler with serializer extension your all set for WebforgeDateTime-Types. Otherwise use annotations like this:

<?php
  
use Doctrine\ORM\Mapping AS ORM;
use JMS\Serializer\Annotation AS Serializer;

class EntityWithTimestamp {

  /**
   * modified timestamp saves the time and date of the last modification
   * 
   * @var Webforge\Common\DateTime\DateTime
   * @ORM\Column(type="WebforgeDateTime", nullable=true)
   * @Serializer\Expose
   * @Serializer\Type("WebforgeDateTime")
   */
  protected $modified = NULL;


  public function updateModified() {
    $this->modified = \Webforge\Common\DateTime\DateTime::now();
  }
}