[RESOLVED] Invoking functions in returned objects, a neater method?
I am trying to invoke a function of an object that is returned by running another function.
Here is my code:
This works, but is there a neater way to do this in one line? I have tried the following, but it doesn't work:
$object = $this->OM->searchChildren('title');
$this->title = $object->collateCharacterData();
$this->title = $this->OM->searchChildren('title')->collateCharacterData();
no, that won't work.
you can have searchChildren return a "ListOf" type of object, and use something like
But note that this makes your code very hard to read.
Yeah, I don't think you gain anything by making it a one-liner, unless you're trying to obfuscate things so no one else can modify the code.
Thanks for the replies - I think you're right though, it does make it rather hard to read. I was really just trying to represent the relational hierarchy in the code but I don't think it really works!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)