首页 > 代码库 > Can't obtain the model 'aid' source from the _models list

Can't obtain the model 'aid' source from the _models list

以下是被执行的代码:

	$areas = $this->builder->from(‘area‘)
		->where(‘aid = 0‘)
		->getQuery()
		->execute()
		->toArray();

	$this->view->setVar(‘areas‘, $areas);

经过研究才发现原来where里面的字段要带着表名的,正确代码:

	$areas = $this->builder->from(‘area‘)
		->where(‘area.aid = 0‘)
		->getQuery()
		->execute()
		->toArray();

	$this->view->setVar(‘areas‘, $areas);


本文出自 “天道酬勤” 博客,请务必保留此出处http://ivendor.blog.51cto.com/8613733/1559303

Can't obtain the model 'aid' source from the _models list