0

I am facing some troubles while updating a table row.

Here is my code

$product = ProductTable::getInstance()->find($product_id);
    $product->setQunatity(($product->getQunatity() - $qty));
    $product->setSellingQty(($product->getSellingQty() + $qty));
    $product->save();

Here symfony automatically update the updated_by field. But I don't want to update that particular field.

Is this is possible in symfony 1.4 . I am using Diem Project 5

Or only super admin can execute those code.

Thanks in advance.

4

1 回答 1

0

updated_at字段由 Doctrine 自动更新(如果您使用此 ORM,则为 Propel)。这要归功于为Timestampable您的模型类设置的行为。据我所知,没有“简单”的方法来控制这种行为。如果您真的希望仅在某些情况下更新该字段,您应该放弃该行为并编写您自己的preSave函数,这些函数将在选定的情况下更新该字段。

于 2013-04-24T12:31:56.317 回答