PHP object-oriented development

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.