I have the following entity Model with property float $price
.
When I create such a getter method:
public function _getPrice()
{
return $this->price*100;
}
It keeps giving me the following error:
Undefined property: App\Model\Entity\Model::$price
What's the problem?
You are essentially trying to access a getter method from within itself.
In order for this to work, try rewriting it as follows:
public function _getPrice()
{
return $this->_properties['price'] * 100;
}