我的symfony编辑表单验证并保存。当我在mysql查询浏览器中检查记录时记录更新,但是当页面刷新时,相同的数据就在那里而且表单没有更新。有什么想法吗?
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);
}
答案 0 :(得分:0)
两种可能性:
我会确保#1不是第一个。我相信你可以通过运行命令
来做到这一点ROLLBACK;
如果您打开一个交易,那将关闭它。