`return $this;` design pattern or anti-pattern?

arberb

New Member
I've seen many times Zend Framework using \[code\]return $this;\[/code\] pattern style - and from my point of view:
  • Pro: seems its quite not bad pattern style for chaining many actions on the same object and making your code shorter.
  • Con: code looks a bit weird when you see that object returns itself in the method, which does something else (e.g. setter for some property)
Is it really good pattern practice or maybe an anti-patternpractice? EDIT: well it was a little too much from my side to call it "pattern", thanks everyone for pointing me to right direction!
 
Top