我正在尝试创建一个新模型,该模型连接到表并使用 CRUD 呈现它们,遵循此示例。
我错过了什么?这不适用于a)文件存储吗?b) 增删改查?或 c)?
有一个客户联系表:
class Model_Contact extends Model_Table {
public $table='customercontact';
function init(){
parent::init();
$this->addField('ContactDate')->type('date')->caption('Contact Date');
$this->addField('ContactNotes')->caption('Notes');
}
}
还有一个联系附件表:
class Model_ContactAttachments extends Model_Table {
public $table='contactattachments';
function init(){
parent::init();
$this->addField('ContactID');
$this->add('filestore/Field_File','FilestoreID')->caption('Upload File');
}
}
这是组合表,按照我理解的示例:
class Model_Contact extends Model_Table {
public $table='customercontact';
function init(){
parent::init();
$this->addField('ContactDate')->type('date')->caption('Contact Date');
$this->addField('ContactNotes')->caption('Notes');
$detail = $this->join('ContactAttachments.ContactID');
$detail->add('filestore/Field_File','FilestoreID')->caption('Upload File');
}
}
导致此错误:
应用程序错误:未为此对象定义方法
异常逻辑,代码:0
Additional information:
class: SQL_Relation
method: addExpression
arguments:
0: ContactAttachments.FilestoreID_text
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib\AbstractObject.php:846
Stack trace:
File Object Name Stack Trace
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib/BaseException.php :63 Exception_Logic Exception_Logic->collectBasicData(Null)
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib/AbstractObject.php :545 Exception_Logic Exception_Logic->__construct("Method is not defined for this object", Null)
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib/AbstractObject.php :846 asol_index_tabs_view_htmlelement_4_crud_model_contact__C SQL_Relation->exception("Method is not defined for this object", "Logic")
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib\Field/Reference.php :30 asol_index_tabs_view_htmlelement_4_crud_model_contact__C SQL_Relation->__call("addExpression", Array(1))
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib\Field/Reference.php :30 asol_index_tabs_view_htmlelement_4_crud_model_contact__C SQL_Relation->addExpression("ContactAttachments.FilestoreID_text")
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4-addons\filestore\lib\Field/File.php :7 ead9409b__act__C_ContactAttachments.FilestoreID filestore\Field_File->setModel("filestore/File", "url")
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib/AbstractObject.php :306 ead9409b__act__C_ContactAttachments.FilestoreID filestore\Field_File->init()
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\lib\Model/Contact.php :19 asol_index_tabs_view_htmlelement_4_crud_model_contact__C SQL_Relation->add("filestore/Field_File", "ContactAttachments.FilestoreID")
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib/AbstractObject.php :306 asol_index_tabs_view_htmlelement_4_crud_model_contact Model_Contact->init()
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib/AbstractObject.php :400 asol_index_tabs_view_htmlelement_4_crud CRUD->add("Model_Contact")
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib/AbstractView.php :92 asol_index_tabs_view_htmlelement_4_crud CRUD->setModel("Contact")
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib\View/CRUD.php :220 asol_index_tabs_view_htmlelement_4_crud CRUD->setModel("Contact")
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\page/index.php :29 asol_index_tabs_view_htmlelement_4_crud CRUD->setModel("Contact")
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib/AbstractObject.php :306 asol_index page_index->init()
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib/ApiFrontend.php :130 asol Admin->add("page_index", "index", "Content")
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib/ApiWeb.php :428 asol Admin->layout_Content()
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib/ApiFrontend.php :39 asol Admin->addLayout("Content")
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb\atk4\lib/ApiWeb.php :275 asol Admin->initLayout()
C:\Program Files (x86)\EasyPHP-DevServer-13.1VC11\data\localweb/index.php :15 asol Admin->main()
Note: To hide this information from your users, add $config['logger']['web_output']=false to your config.php file. Refer to documentation on 'Logger' for alternative logging options