Could someone tell me how to add the default value on a DateTime column? I can’t do it like this:
protected $registration_date = date("Y-m-d H:i:s", time());
So how can I handle it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You map your property as DateTime type then set the value in the constructor using a new DateTime instance:
This works as the constructor of a persisted class is not called upon hydration.