1

atk4 Web サイトで入手可能なサンプル コードを実行しようとしています。コードをダウンロードし、モデルと生成ページを作成しました。ただし、 http://localhost/demo/atk4-example/?page=generateを使用して SQL を生成しようとすると、Apache エラー ログに次のエラーが表示されました。

[Mon Sep 19 21:35:31 2011] [error] [client 127.0.0.1] PHP Fatal error:  Call to a member function getAllHash() on a non-object in /var/www/html/demo/atk4-example/atk4-addons/mvc/Page/SchemaGenerator.php on line 69, referer: http://localhost/demo/atk4-example/?page=generate

モデルは次のとおりです。

カテゴリ.php:

class Model_Category extends Model_Table {
    public $entity_code = 'category_table';
    public $table_alias = 'ct';
    function init(){
        parent::init();

        $this->addField('name');
    }
}

Job.php:

class Model_Job extends Model_Table {
    public $entity_code = 'job_table';
    public $table_alias = 'jt';
    function init(){
        parent::init();
        $this->addField('category_id')->refModel('Model_Category');
        $this->addField('type');
        $this->addField('company');
        $this->addField('logo');
        $this->addField('url');
        $this->addField('position');
        $this->addField('location');
        $this->addField('description')->type('text');
        $this->addField('how_to_apply')->type('text');
        $this->addField('is_public')->type('boolean');
        $this->addField('is_activated')->type('boolean');
        $this->addField('email');
        $this->addField('token');
        $this->addField('created_dts')->type('timestamp')->system(true);
        $this->addField('updated_dts')->type('timestamp')->system(true);
        $this->addField('expires_at')->type('date')->system(true);
    }
}

ページ/generate.php:

class page_generate extends Page_SchemaGenerator {}

いくつかのパス設定がありませんか?

4

1 に答える 1

2
Call to a member function getAllHash() on a non-object in
/var/www/html/demo/atk4-example/atk4-addons/mvc/Page/SchemaGenerator.php
on line 69

そして、この行は

$res = $this->api->db->getAllHash("desc $table");

$this->api->dbオブジェクトではないことを意味します。
atk4-example/page/dbtest.php を見てください。$this->api->dbConnect();おそらく api->db プロパティを設定して呼び出します。

于 2011-09-19T16:29:08.040 に答える