I thought I was pretty comfortable with the fundamentals of OOP in a few languages like Python and PHP, but I got a bit confused trying to figure out what's going on in certain situations in CakePHP.
Say for example I'm in a controller called TestsController but I want to look up data from another controller, such as OthersController. I'd do something like this
$this->loadmodel('Other');
$this->Other->find('all');
I understand that $this is a reference to the object of the class you're in, and Other clearly refers to OthersController, but what exactly is Other? Is it some kind of initialization variable? An Object? Something else? Does $this->Other become an object itself? If so, how does PHP/CakePHP do this, or is it just something inherent of PHP that it just "knows" to do so.
I found this example of something called method chaining, but it looks like using one object to call many actions.
<?php
class MyClass{
public $prop1 = "I'm a class property!";
}
$obj = new MyClass;
echo $obj->prop1; // Output the property
?>
I understand with $obj you're accessing $prop1, but what's happening in CakePHP when there's something like $obj->SomeModel->action()?
If possible could you modify that little OOP example to mimic that of CakePHP?