bakerjr
bakerjr

Reputation: 397

When saving to a model, created and modified aren't automatically populated by CakePHP. Using SQL Server

Hi when saving to a model, my created and modified fields aren't automatically populated by CakePHP. It was automatically populated when I was using MySQL but now it isn't. I'm not using NOW() back when I was still using MySQL. Why is it? Also when a field's value is not set 'NULL' (with quotes) is inserted causing errors because SQL Server says I can't insert a string to a field of type smallint/date etc. How do I fix this?

Thanks in advance!

Upvotes: 1

Views: 85

Answers (1)

David Yell
David Yell

Reputation: 11855

I would set NULL as a keyword rather than quoting it, which I imagine is why your database thinks that it's a string.

Have you double checked the schema of the database to ensure that the created and modified fields are still DATETIME fields.

Also you say "SQL Server", and mention MySQL, so I assume that you are now using MSSQL?

Upvotes: 1

Related Questions