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);


你可能感兴趣的:(phalcon)