tags:

views:

35

answers:

1

My symfony edit form validates and saves. When I check the record in mysql query browser the record updates, but when the page refreshes the same data is there and the form hasn't updated. Any thoughts?

    public function executeEdit(sfWebRequest $request)
  {

    $this->forward404Unless($items = Doctrine::getTable('items')->find(array($request->getParameter('item_id'))), sprintf('Object items does not exist (%s).', $request->getParameter('item_id')));
    //make sure the item being edited is owned by the logged in user
    $this->forward404Unless($items->getUser_id()==$this->getUser()->getGuardUser()->getId());

    $cacheDir = sfConfig::get('sf_cache_dir').'/'. $app.'/'.$env.'/';

  //Clear cache
  $cache = new sfFileCache(array('cache_dir' => $cacheDir));
  $cache->clean();
    //set category id
       $query=Doctrine_Query::create()
      ->select('name')
      ->from('categories')
      ->where('category_id="'.$items->category_id.'"')
      ->limit(1);
      $category=$query->fetchArray();
      @$items->category_id=$category[0]['name'];
    $this->form = new itemsUserForm($items);
  }
A: 

Two possibilities:

  1. You have an open transaction in MySQL
  2. You're not looking at the record in the browser you think you're looking at

I would make sure that #1 is not the case first. I believe you can do this by simply running the command

ROLLBACK;

If you have a transaction open, that will close it.

Jason Swett
it updates just not after the first refresh. If I wait a couple of seconds it appears. Anyway to make it immediate?
Ite Code
Also on a code with a simple query, I have to refresh as well. This is weird.
Ite Code