Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Model Calls - Non static
  • Hi guys, I have a model with various static methods in such as add_author
    select_author
    select_author_list and so on... I however have a function that will need to bind a few together..
    How would i go about this in Fuel? I am guessing i have to construct the model .. Whats Fuels method of this? Thanks,
  • What do you mean by "bind a few together"? Can you give an example (or write it out)?
  • Sure... function one - Inserts into a table then returns the insert id.
    function two - Inserts into a different table then returns the insert id. function three - Calls function one, inserts data, gets the id and uses it to insert into function two. I would like to retain the functionality of function one, and two.. but not have to duplicate the insert methods for func 3.. Does this make a little more sense?..
  • Ok, so the question is "how do I call a static method in the current class"?
    public static function three()
    {
        // call the static method two() in the current class.
        $result = static::two();
    }
    
  • Ahh ok, thank you for that dumb question.. I was focusing on actually trying to instantiate the model .. Totally the wrong way to look at it.. Thanks again..

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion