/** * sets this record's temporal dates between a parent record's temporal dates (so that parent_eff <= my_eff < my_exp <= parent_exp) * @param $record Doctrine_Record * @return null */ public function setDatesWithinParent(Doctrine_Record $parent) { $child = $this->getInvoker(); if ($parent->getEffectiveDate() > $child->getEffectiveDate()) { $child->{$this->_options['eff_date']} = $parent->getEffectiveDate(); } if (!is_null($parent->getExpirationDate()) && (is_null($child->getExpirationDate()) || $parent->getExpirationDate() < $child->getExpirationDate())) { $child->{$this->_options['exp_date']} = $parent->getExpirationDate(); } // sanity check: if we end up with nonsense, then self-destruct. if (!is_null($child->getExpirationDate()) && $child->getExpirationDate() <= $child->getEffectiveDate()) { throw new Doctrine_Record_SavingNonsenseException("Nonsense child record with id {$child->id} should be deleted by parent"); } }