function postSave() { $this->removeCache($this->getId()); $this->removeCache('include_pay_stub_entry-' . $this->getId()); $this->removeCache('exclude_pay_stub_entry-' . $this->getId()); if ($this->getDeleted() == TRUE) { //Check if any users are assigned to this, if so, delete mappings. $udlf = new UserDeductionListFactory(); $udlf->StartTransaction(); $udlf->getByCompanyIdAndCompanyDeductionId($this->getCompany(), $this->getId()); if ($udlf->getRecordCount()) { foreach ($udlf as $ud_obj) { $ud_obj->setDeleted(TRUE); if ($ud_obj->isValid()) { $ud_obj->Save(); } } } $udlf->CommitTransaction(); } return TRUE; }