Re: [PHP] Method chaining off constructors

2008-06-06 Thread Robert Cummings
On Fri, 2008-06-06 at 11:35 -0400, Christoph Boget wrote: > > The 'new' keyword has to apply to the object created in the constructor (and > > not the return value of any of the follow-up calls.) To establish this > > precedence, chaining wasn't allowed on constructors. > > If precedence was th

Re: [PHP] Method chaining off constructors

2008-06-06 Thread Christoph Boget
> The 'new' keyword has to apply to the object created in the constructor (and > not the return value of any of the follow-up calls.) To establish this > precedence, chaining wasn't allowed on constructors. If precedence was the issue, why doesn't this work, either: (new bob())->one()->two()

Re: [PHP] Method chaining off constructors

2008-06-06 Thread Adam Richardson
The 'new' keyword has to apply to the object created in the constructor (and not the return value of any of the follow-up calls.) To establish this precedence, chaining wasn't allowed on constructors. On Fri, Jun 6, 2008 at 11:04 AM, Eric Butera <[EMAIL PROTECTED]> wrote: > On Fri, Jun 6, 2008

Re: [PHP] Method chaining off constructors

2008-06-06 Thread Eric Butera
On Fri, Jun 6, 2008 at 11:00 AM, Christoph Boget <[EMAIL PROTECTED]> wrote: >> > Why? I thought constructors returned the object? >> It's been a while since I've played with objects in PHP, but couldn't >> you just add the line: >> return $this; >> ...to the end of your __construct() function? Sor

RE: [PHP] Method chaining off constructors

2008-06-06 Thread Christoph Boget
> > Why? I thought constructors returned the object? > It's been a while since I've played with objects in PHP, but couldn't > you just add the line: > return $this; > ...to the end of your __construct() function? Sorry if this is obtuse of > me to say, I just thought maybe the answer was that sim

RE: [PHP] Method chaining off constructors

2008-06-06 Thread Boyd, Todd M.
> -Original Message- > From: Christoph Boget [mailto:[EMAIL PROTECTED] > Sent: Friday, June 06, 2008 9:45 AM > To: PHP General > Subject: [PHP] Method chaining off constructors > > Is there a reason why you can't do method chaining off of constructors? > > Consider the following class: >