/** * returns true if this time period is contained by the given one, and their start dates are the same (given.eff == my.eff < my.exp < given.exp) * @param $theirs * @return boolean */ public function ends(Doctrine_Temporal_TimePeriod $theirs) { // does the given time period contain this one? (theirs.eff <= my.eff < my.exp <= theirs.exp) if (!$theirs->containsPeriod($this)) { return false; } // do they end on the same date? if (is_null($this->exp_date) && is_null($theirs->exp_date)) { // consider two infinite end dates to be 'equal' return true; } return $this->exp_date == $theirs->exp_date; }
public function setLengthDays($days) { $record = $this->getInvoker(); $tp = new Doctrine_Temporal_TimePeriod($record->eff_date, $record->eff_date); $tp->setLengthDays($days); $record->exp_date = $tp->getExpirationDate(); }