symfonysymfony-1.4diem-cms

Handle updated_by field while update a table row in Symfony 1.4


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.


Solution

  • The updated_at field is updated automatically by Doctrine (or Propel if you're using this ORM). It is done thanks to Timestampable behaviour set to your model class. As far as I know there is no "easy" way to control this behaviour. If you really want to have this field only updated on some occasion you should drop the behaviour and write your own preSave functions which will update the field in chosen circumstances.