/** * save a model and collect any error messages that may be returned * return the model PKID whether insert or update * * @param BaseModel $model * @throws ValidationException * @return int */ function simpleSave($model) { $result = $model->save(); // if the save failed, gather errors and return a validation failure if ($result == false) { throw new ValidationException("Validation Errors Encountered", array('code' => '7894181864684', 'dev' => 'entity->simpleSave failed to save model'), $model->getMessages()); } return $model->getPrimaryKeyValue(); }