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

时间:2014-06-30 07:24:03

标签: php model-view-controller zend-framework2

使用它时,这将成功提供结果集对象

$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 } ?>

1 个答案:

答案 0 :(得分:0)

在控制器本身中尝试这个 -

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

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

并检查您是否获得任何值。