david wrote:
pb:the method is called but the property value is not modified why?? Thanks
Your issue is a nasty thing called SCOPE.
That's the biggest part of OOP, however and one that you will hate at first and then come to regard as a humble annoyance that really does mean well.
When you call another object/class from another objects scope, that object is only effected in current objects scope.
So the reference of OBJECT passed to ANOTHER_OBJECT is unique to ANOTHER_OBJECT and not ANYOTHER_OBJECT.
How does one get around this?
Well, work with the easiest scope there is.
Put everything you want to be accessable by ALL_OBJECTS into the GLOBAL scope.
so when you call
$subChapter->select()
that function will not set
$this->subChapter
but instead set: $GLOBALS['subChapter'];
Which is then made accessable to ALL_OBJECTS
which may pass it around and have their ways with it as they please and all references to that $GLOBAL will take hold world-wide.
And of course, you can make your objects $GLOBAL as well, which is very handy for referencing objects from within without having to pass the reference.
...hope that helps.
There's an entire section in the manual about variables and scopes, check it out.