开发者

How to update tables using generated set functions in Symfony

Hiya, could someone tell me how to use those automatic set functions?

I have a column called "deleted". When a user clicks a link, it goes to a delete action. The delete action previously deleted a row in the db. Now I just want it to set the deleted field value of that row to 1. Symfony has created a function called setDelete(), but I don't know how to use it. I am trying this:开发者_如何学C

$consultant = Doctrine_Core::getTable('consultant')->find(array($request->getParameter('id')));
$consultant->setDeleted('1');

I'm not getting any errors, but it's still not updating the table.


you will have to execute $consultant->save(); after the set.

By the way, since symfony 1.4.3 you can call ConsultantTable::getInstance() instead of Doctrine_Core::getTable('consultant') which allows your IDE to autocomplete the methods in the model.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜