开发者

symfony updates table but not form

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 e开发者_Python百科xecuteEdit(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);
  }


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜