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:
- You have an open transaction in MySQL
- 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.
精彩评论