Digi92
4/15/2017 - 8:48 PM

Doctrine Add default field value.

Doctrine Add default field value.

<?php
namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Class Example
 * @package AppBundle\Entity
 * @ORM\Entity
 * @ORM\Table(name="example")
 */
class Example {
  
    /**
     * CreatedDate
     *
     * @ORM\Column(type="datetime", options={"default"="CURRENT_TIMESTAMP"})
     * @var \datetime
     */
    protected $createdDate;
    
    /**
     * Returns the CreatedDate
     *
     * @return \datetime
     */
    public function getCreatedDate()
    {
        return $this->createdDate;
    }
}