Php 无法从相应的表zf2中检索数据

Php 无法从相应的表zf2中检索数据,php,model-view-controller,zend-framework2,Php,Model View Controller,Zend Framework2,使用此选项时,将成功提供resultset对象 $goals = $this->getGoalTable()->listgoal($userid); $goals->current(); return new ViewModel(array( 'paginator' => $goals, )); 但是当我找回这个的时候,我变得一片空白!没有数据,也没有错误 <?php foreach($paginator as $row){ ?> <?php

使用此选项时,将成功提供resultset对象

$goals = $this->getGoalTable()->listgoal($userid);
$goals->current();
return new ViewModel(array(
'paginator' => $goals,
));
但是当我找回这个的时候,我变得一片空白!没有数据,也没有错误

<?php foreach($paginator as $row){ ?>
    <?php print_r($row);    // this is giving its own model's data of controller but not my goal tables data  ?>
       <?php echo $this->escapeHtml($row->name);   // getting blank values here  ?>
       <?php echo $this->escapeHtml($row->coach_email);  // getting blank values here ?>
<?php } ?>


在控制器本身中尝试此操作-

$goals = $this->getGoalTable()->listgoal($userid);
$goals->current();

print_r($goals); //Its an object with single array.
exit();

并检查是否得到任何值。

print\r($row);只给我它自己的控制器模型数据,而不给目标表数据,我的意思是我的控制器名称是user,所以它只给我user tables数据值,即使是
print\r($goals)
给你同样的结果?你能提供问题中的
getGoalTable()
listgoal()
函数代码吗?