Php 什么';这里怎么了?Zend FW getDependentRowSet()

Php 什么';这里怎么了?Zend FW getDependentRowSet(),php,database,zend-framework,zend-db,Php,Database,Zend Framework,Zend Db,正在尝试在ZF应用程序中使用getDependentRowset。我在两个表之间有以下关系: 其中,用户的组织是组织表PK、OrganizationID的FK 我要做的是,通过用户Id(user.userId)检索用户的组织名称(organization.name) 以下是我的用户db表模型: class Application_Model_DbTable_User extends Zend_Db_Table_Abstract { protected $_name = 'us

正在尝试在ZF应用程序中使用getDependentRowset。我在两个表之间有以下关系:

其中,用户的组织是组织表PK、OrganizationID的FK

我要做的是,通过用户Id(
user.userId
)检索用户的组织名称(
organization.name

以下是我的用户db表模型:

class Application_Model_DbTable_User extends Zend_Db_Table_Abstract
{

        protected $_name = 'user';

        //define foreign keys here
        protected $_referenceMap = array (
            'Organisation'=> array (
            'columns'=>'organisation_organisationId',
            'refTableClass'=>'Organisation',
            'refColumns'=>'organisationId'
            )
        );

        public function getUser($emailAddress, $password) {

            $select = $this->select()
                            ->where("emailAddress = \"$emailAddress\" AND password=\"$password\"", 1);
            $row = $this->fetchRow($select);
            return $row;

        }

    }
以及我的IndexController中有问题的代码:

$user = new Application_Model_DbTable_User();
$res = $user->getUser($emailAddress, $password);
$organisationInfo = $res->findDependentRowset('organisation');
想法是什么导致了这一切?我知道这是相对简单的东西


谢谢

我相信组织表是用户表的父表。因此,您应该使用
$res->findParentRow('Application\u Model\u DbTable\u Organization')。但是,如果要查找给定组织中的所有用户,则可以使用组织行对象的
getDependentRowSet()
方法。

我相信组织表是用户表的父表。因此,您应该使用
$res->findParentRow('Application\u Model\u DbTable\u Organization')。但是,当您想要查找给定组织中的所有用户时,您会使用组织行对象的
getDependentRowSet()
方法。

这就解决了!非常感谢!还需要将用户模型中的refTableClass更改为“refTableClass”=>“Application\u Model\u DbTable\u Organization”。这就解决了问题!非常感谢!还需要将用户模型中的refTableClass更改为“refTableClass”=>“应用程序\模型\数据库\组织”。