Welcome Guest, Not a member yet? Register   Sign In
Calling other Model functions inside the Model
#5

[eluser]lookatthosemoose[/eluser]
Edit: I just realized the function below is a different one than referenced above, but same concept.

I'm using the active record class/methodology. So Im endeavoring to keep all the methods in this fashion:

Code:
function get_alias($id,$return_value=FALSE){
       $query = $this->db->get_where('addresses',array('alias_id' => $id));

        if($return_value){
            $row = $query->first_row();
            return ($query->num_rows() > 0) ? $row->alias : NULL;
        }
        
        return $query->$query->result();
    }

I've added an optional parameter to dictate whether to return the object, or the value. Thus, best of both worlds.


Messages In This Thread
Calling other Model functions inside the Model - by El Forum - 02-27-2008, 07:01 PM
Calling other Model functions inside the Model - by El Forum - 02-27-2008, 07:11 PM
Calling other Model functions inside the Model - by El Forum - 02-27-2008, 07:29 PM
Calling other Model functions inside the Model - by El Forum - 02-27-2008, 08:44 PM
Calling other Model functions inside the Model - by El Forum - 02-28-2008, 10:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB