Hello,

$this only calls variables inside of a method. In your function, you are
calling a variable that was defined inside of your function called
$columnName. You should past the whole class. Not just the methods.

"The pseudo-variable $this is available when a method is called from within
an object context. $this is a reference to the calling object (usually the
object to which the method belongs, but possibly another object, if the
method is called statically from the context of a secondary object). " taken
from http://www.php.net/manual/en/language.oop5.basic.php

The parent keyword indicates that this is an extended class. You are
referring back to the master class.

Ravi.


On Wed, Dec 22, 2010 at 9:35 AM, Alexandru Patranescu <dreal...@gmail.com>wrote:

> Is this the only way to access the magic __set from the parent class:
>
>    public function __set($columnName, $value)
>    {
>        if ($value !== $this->$columnName) {
>            parent::__set($columnName, $value);
>        }
>    }
>
>
> I would have liked to work this way:
>
>    public function __set($columnName, $value)
>    {
>        if ($value !== $this->$columnName) {
>            parent::$columnName = $value;
>        }
>    }
>
>
> And another question.
> There is a self, a static and a parent
> Why is it only $this and not a $parent too?
>

Reply via email to