Welcome Guest, Not a member yet? Register   Sign In
Using a model multiple times.
#1

[eluser]Unknown[/eluser]
I may be being a bit dumb here... but anywho...

I have a category model which contains your average CRUD functionality and data related properties.
There is a method called load() which takes a category identifier to load the requested category.
However, when I'm trying to load the category parent from within eg;
Code:
....
public function load( $id )
{

   // get category and set info...

   if( !is_null( $record->parent_id ) )
   {
       $this->_parent = $this->category->load( $parent_id );
   }

}
...
it returns
Code:
Admin_Category Object
(
    .....
    [_parent_id:protected] => 6
    [_parent:protected] => Category Object
        (
            .....
            [_parent_id:protected] =>
            [_parent:protected] => Category Object
*RECURSION*
        )

)
When I use the standard $obj = new Obj(); method, everything is returned fine, like so;
Code:
Admin_Category Object
(
    .....
    [_parent_id:protected] => 6
    [_parent:protected] => Category Object
        (
            [_id:protected] => 6
            .....
            [_parent_id:protected] => 10
            [_parent:protected] => Category Object
                (
                    [_id:protected] => 10
                    .....
                    [_parent_id:protected] =>
                    [_parent:protected] =>
                )

        )

)

I guess my question, is is there a way of getting $this->obj_name to return a new object like the method in the previous sentence does?

Sorry if i'm being a fool, i've had a really bad week and my head is battered...

Cheers!




Theme © iAndrew 2016 - Forum software by © MyBB