public function afterSave($created) { parent::afterSave($created); if (isset($this->data['Customer']['customer_type_id']) && (@$this->data['Customer']['customer_type_id'] == 2 || @$this->data['Customer']['customer_type_id'] == 3)) { if (!empty($this->data['BuilderAccount']['effective_date'])) { $this->data['BuilderAccount']['effective_date'] = $this->formatDate($this->data['BuilderAccount']['effective_date']); } $this->data['BuilderAccount']['customer_id'] = $this->id; $this->BuilderAccount->deleteAll(array('BuilderAccount.customer_id' => $this->id)); $this->BuilderAccount->save($this->data['BuilderAccount']); } else { $this->BuilderAccount->deleteAll(array('BuilderAccount.customer_id' => $this->id)); } }