public function loadSpouse($id) { $model = Spouse::model()->findByAttributes(array('employee_id' => $id)); if ($model === null) { $model = new Spouse(); } return $model; }