Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doctrine "on update CURRENT_TIMESTAMP" annotation (Symfony2)

I need to make annotation for column in my entity - "on update CURRENT_TIMESTAMP" attribute. How can I do that?

like image 225
michail_w Avatar asked Jan 13 '23 15:01

michail_w


1 Answers

You cannot use your own column definition:

/**
 * @ORM\Column(type="datetime", columnDefinition="DATETIME on update CURRENT_TIMESTAMP")
 */
private $updatedAt;

The example is for MySQL. Take into account, that columnDefinition is not portable among different databases or even their versions.

like image 53
Aistis Avatar answered Jan 16 '23 21:01

Aistis