Php 如何在magento网格函数\u prepareCollection中加入两个表admin_角色和admin_用户
我只是尝试使用函数_prepareCollection获取Magnetor中两个表的集合Php 如何在magento网格函数\u prepareCollection中加入两个表admin_角色和admin_用户,php,mysql,magento,Php,Mysql,Magento,我只是尝试使用函数_prepareCollection获取Magnetor中两个表的集合 protected function _prepareCollection() { $collection = Mage::getResourceModel('admin/user_collection'); $collection->getSelect()->join( array('table_alias'=>$this->getTable
protected function _prepareCollection()
{
$collection = Mage::getResourceModel('admin/user_collection');
$collection->getSelect()->join( array('table_alias'=>$this->getTable('admin/admin_role')), 'main_table.user_id = table_alias.user_id', array('table_alias.*'));
$this->setCollection($collection);
return parent::_prepareCollection();
}
但其显示语法错误:
SQLSTATE[42000]:语法错误或访问冲突:1103不正确的表名“”您可以先尝试打印select语句以查看管理员用户集合表的表别名,然后使用它而不是
main\u表
为此,请编写以下语句
echo $collection->getSelect()->__toString();