Hi!
Here is my relations:
-"server" BELONGS_TO "site"
-"site" HAS_MANY "contracts"
In a function of my class server, I want get the greatest subscription date defined in my contract. Here is what I do:
$subscription_date=null;
foreach ($this->site->contracts as $contract) {
if ($contract->subscription_date>$subscription_date)
$subscription_date=$contract->subscription_date;
}
It works but it’s not very smart… Is there a way to simplify that?
Thanks!