webforge/symfony

1.7.1 2017-11-03 12:19 UTC

This package is auto-updated.

Last update: 2024-11-07 03:12:19 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();
  }
}