Magic properties in child model

Hi

I have such class relations: Product->Book->EBook

class Product extends ActiveRecord {...}
class Book extends Product {...}
class EBook extends Book {...}

Book Model has the calculated property
getRebatedPrice() {...}
and accessed via magic getter
$book->rebatedPrice;

In the EBook model, I need to override calculations for this property, so I do it:

class EBook extends Book
{
    public function getRebatedPrice() {...}
}

But when I’m trying to get value via $ebook->rebatedPrice I get a value from the parent method of the Book model.

Complete code:

class Product extends ActiveRecord {...}
class Book extends Product 
{
    public function getRebatedPrice() {
       return 1;
    }
}
class EBook extends Book 
{
    public function getRebatedPrice() {
       return 2;
    }
}


$ebook = EBook::findOne([...]);
$price = $ebook->rebatedPrice; // got $price = 1, but expected $price = 2
$price = $ebook->getRebatedPrice(); // got value $price = 2, as expected

I have just tested your example on two models (so it would be Product and Book in your example) and I got 2 in both cases. I’m not sure if the third one is needed to replicate the issue or something else is involved in here like maybe Product table already has rebatedPrice column.