Jump to content

Recommended Posts

The question I have is if you notice with the line below its supposed to get the status name of the title. However in the get_title_statuses function it returns an object so I’m trying to figure out how when I need only a certain value of one of the keys in the object I can just return the value.

 

[color=#000000][color=#0000BB]$titles [/color][color=#007700]= [/color][color=#0000BB]$this[/color][color=#007700]->[/color][color=#0000BB]titles_model[/color][color=#007700]->[/color][color=#0000BB]get_titles[/color][color=#007700](array([/color][color=#DD0000]'title_status' [/color][color=#007700]=> array([/color][color=#0000BB]1[/color][color=#007700],[/color][color=#0000BB]2[/color][color=#007700],[/color][color=#0000BB]3[/color][color=#007700])));

for([/color][color=#0000BB]$x [/color][color=#007700]= [/color][color=#0000BB]0[/color][color=#007700]; [/color][color=#0000BB]$x [/color][color=#007700]< [/color][color=#0000BB]count[/color][color=#007700]([/color][color=#0000BB]$titles[/color][color=#007700]); [/color][color=#0000BB]$x[/color][color=#007700]++)[/color]
[color=#0000BB]{
$titles[$x][/color][color=#007700]->[/color][color=#0000BB]title_status_name [/color][color=#007700]= [/color][color=#0000BB]$this[/color][color=#007700]->[/color][color=#0000BB]titles_model[/color][color=#007700]->[/color][color=#0000BB]get_title_statuses[/color][color=#007700](array([/color][color=#DD0000]'titles' [/color][color=#007700]=> [/color][color=#0000BB]$titles[$x][/color][color=#007700]->[/color][color=#0000BB]title_status_id[/color][color=#007700])); [/color]
[color=#0000BB]} [/color] [/color] 

 

Here's a link to what I have for my model functions. I had to include it in a separate place.

 

http://pastebin.com/h6XZvr4s

If anyone's wondering,

$titles = $this->titles_model->get_titles(array('title_status' => array(1,2,3)));

for($x = 0; $x < count($titles); $x++)
{
    $titles[$x]->title_status_name = $this->titles_model->get_title_statuses(array('titles' => $titles[$x]->title_status_id));
}

 

If you just need one of the members of the object then just get that one member and discard the rest.

I have no idea how my post code showed up like that but thank you. Were you able to take a look at the controller code. Working with OOP is nice but here's a situation where with the class function and its possible parameters I need it to get a row value or a whole row or whole object and I'm not sure what I can do right now to account for that? And each situation is pretty much based on what parameters there are.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.