Bayezid Alam
Bayezid Alam

Reputation: 380

How to update or save a specific field only in CakePHP 3.0?

I want to update or save a specific field of a table in Cakephp 3.0. I tried Updating Data from the Cakebook and it is saving the data but problem is that it is also saving the modified field assigned as datetime in database. I do not want to save this field in that case. How do i do that?

Thanks in advance

Upvotes: 3

Views: 4291

Answers (1)

When you don't want callbacks to be triggered, just use updateAll()

$table->updateAll(['field' => $newValue], ['id' => $entityId]);

Upvotes: 7

Related Questions