0

how I can assign (cuurent_time) a default value to a variable ($dateajout)

/**
 * @var \DateTime
 *
 * @ORM\Column(name="dateajout", type="datetime" , nullable=true)
 */
private $dateajout;
Rufinus
  • 29,200
  • 6
  • 68
  • 84
  • 1
    Please show an effort to solve the issue on your own. Include how you did so, and the results. Simply quoting code and asking how it's done is off-topic for StackOverflow. [How to ask a question](http://stackoverflow.com/help/how-to-ask) – CmdrSharp Jun 22 '14 at 15:11

1 Answers1

1

Have you tried this:

class Dummy
{

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="dateajout", type="datetime" , nullable=true)
     */
    private $dateajout;

    public function __construct()
    {
        $this->dateajout = new \DateTime();
    }

}

?

Denis V
  • 3,290
  • 1
  • 28
  • 40