Hi, thanks a lot Alex and Larry for your very clear answer!

Paola,

On Fri, Mar 4, 2011 at 4:33 PM, la...@garfieldtech.com <
la...@garfieldtech.com> wrote:

> That's called method chaining.  ->getColumns() will get called on the
> object returned by ->getTable().  That is, getTable() returns an object
> (presumably representing an SQL table, I guess), and that object has a
> getColumns() method, which you call.
>
> This is an extremely common style in Javascript code that has been gaining
> widespread use in PHP OO circles in recent years.  If leveraged properly it
> can create very compact, very readable, very powerful code.  (And if done
> stupidly can lead to a horrid mess, but that's true of any coding style.)
>
> --Larry Garfield
>
>
> On 3/4/11 1:25 PM, Paola Alvarez wrote:
>
>> Hi there!,
>> I have been reading this list before but this is my first post.
>> Reading some code from Symfony I got this: $this->getTable()->getColumns()
>> ...when you can use this double method access?, I used before the
>> regular $this->getTable(), but two?. I mean I have been trying but I got
>> an
>> error*
>>
>> * Fatal error: Call to a member function ... on a non-object in ...
>>
>> Thanks!
>>
>> Paola
>>
>> PS: BTW, sorry my english isnt really good
>>
>>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to