Parent ::或$ this->

I am starting a new project and i am not sure whats the best/right why of getting the parents methods?

should it be done this why

class ControllerForum extends ControllerAbstract
{
    public function __construct()
    {
        parent::__construct();
    }

    public function actionViewThread($threadName, (int) $threadId)
    {
        $threadModel = $this->getModel('ModelThread');
    }
}

or this why

class ControllerForum extends ControllerAbstract
{
    public function __construct()
    {
        parent::__construct();
    }

    public function actionViewThread($threadName, (int) $threadId)
    {
        $threadModel = parent::getModel('ModelThread');
    }
}

Thank you.

They do two different things:

When you call $this->method() you are calling the method() defined in your own child class (ControllerForum in this case).

When you call parent::method() you are calling the one defined in the parent class (ControllerAbstract).

So if we, let's say, define getModel in both ControllerAbstract and ControllerForum (override) then calling one or another will execute different code. I would use the inherited method (the first form) unless you need specific behaviour.

EDIT: @Chris It's inheritance, it means that the child class (that extends the parent class) will have the methods and properties of the parent class. When you use $this->method() you don't call the parent method, you call the method of the current class inherited from the parent class. See PHP 5 inheritance

always code depend on the need

if you are able to create object of class then normally we are use first way

$threadModel = $this->getModel('ModelThread');

the second approach is use when we want to call function without object

$threadModel = parent::getModel('ModelThread');

so it's based on need

Thanks