目前我在Yii2教程中使用本指南:http://www.yiiframework.com/doc-2.0/guide-start-databases.html
我尝试根据我的Oracle SQL数据库将Country示例修改为我自己的表,并且我一直收到此错误。
这是我的模型(AlumniReportListing.php);
<?php
namespace app\models;
use yii\db\ActiveRecord;
class AlumniReportListing extends ActiveRecord
{
}
这是控制器(AlumniReportListingController);
<?php
namespace app\controllers;
use yii\web\Controller;
use yii\data\Pagination;
use app\models\AlumniReportListing;
class AlumniReportListingController extends Controller
{
public function actionIndex()
{
$query = ALUMNI_MEMBER_DETAIL::find();
$pagination = new Pagination([
'defaultPageSize' => 5,
'totalCount' => $query->count(),
]);
$student = $query->orderBy('AMD_STUD_ID')
->offset($pagination->offset)
->limit($pagination->limit)
->all();
return $this->render('index', [
'student' => $student,
'pagination' => $pagination,
]);
}
}
最后是View(index.php);
<?php
use yii\helpers\Html;
use yii\widgets\LinkPager;
?>
<h1>Alumni Student Listing</h1>
<ul>
<?php foreach ($student as $stud): ?>
<li>
<?= Html::encode("{$stud->AMD_STUD_ID} ({$stud->AMD_MEM_ID})") ?>:
<?= $stud->AMD_NAME ?>
</li>
<?php endforeach; ?>
</ul>
<?= LinkPager::widget(['pagination' => $pagination]) ?>
我相信我需要做一些事情来创建ALUMNI_MEMBER_DETAIL以使其作为一个对象存在,但我很困惑如何做到这一点,因为Country示例工作正常。