Some problems with PHP object-oriented development the following code is a method in the class:
Public function getHead (){
$ Map = array (
'A. status' => array ('EQ ', 1 ),
'A. recommend' => array ('EQ ', 1)
);
$ Prefix = C ('Db _ prefix ');
$ Data = $ this-> Table ("{$ prefix} auction as A")->
Join ("{$ prefix} accessory as ac on a. goods_pic = AC. id")->
Join ("{$ prefix} accessory as acc on a. agopic = ACC. id")->
Field ('A. *, AC. path, ACC. path as agopath ')-> where ($ map)->
Find ();
Return $ data;
}
In the following code, $ this-> Table ("...") cannot be found anywhere! Why? Please advise!
$ Data = $ this-> Table ("{$ prefix} auction as A")->
Join ("{$ prefix} accessory as ac on a. goods_pic = AC. id")->
Join ("{$ prefix} accessory as acc on a. agopic = ACC. id")->
Field ('A. *, AC. path, ACC. path as agopath ')-> where ($ map)->
Find ();
Reply to discussion (solution)
Does the current class or its parent class have the Table method?
The class of your method is inherited from a database base class (or a base class)
If you do not find the table method definition in this class (or its parent class), you must define a _ call method.
Does the current class or its parent class have the Table method?
Absolutely does not exist!
You can find it in the mysql class.
The class of your method is inherited from a database base class (or a base class)
If you do not find the table method definition in this class (or its parent class), you must define a _ call method.
Experts are experts! Just a word! The _ call method is indeed a method that often works! Neglected! This is the case for me! Thank you very much!