I'm a n00b tying to get my head around the operator syntax. I understand it's called the object operator and I can see how it's used (Where do we use the object operator "->" in PHP?) by itself.
I'm trying to learn what the purpose is when they are strung together like in this snippet (e.g. "switch($this->request->param('id')):
here's a snippet of code from a site using Kohana:
public function action_list()
{
$connections = ORM::factory('Connection')
->with('property')
->with('inviter');
switch ($this->request->param('id')) {
// more code...
}
}
It's called "method chaining". It allows you to apply more then one method, and thus do more then one thing, in one call. It's sort of the OOP equivalent of nesting functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With