I have this getter in an entity
public function _getOver(){
return ($this->montant_heure + $this->montant_materiel) - $this->montant_credit ;
}
In a view, I Have this line somewhere in a foreach
<td><?= round($p->over, 2) ?></td>
It gets the value correctly Now, if I want to do this
<td <?php if($p->over < 0){echo "class=\"over-negatif\"";} ?>><?= round($p->over, 2) ?></td>
I realise that It does not just get the value … it executes something and now the values are incorrect.
I really would have tought of the code in the entity would have acted as a getter – and not change anything… what would be the correct way of doing this ?
Edit : setting a variable and then using it works
<?php $Over = $p->over ?> <!-- then use $Over intead of $p->over -->
But I wonder if there is a way of being sure the entity get something without setting anything.