コード例 #1
0
ファイル: Status.php プロジェクト: soetedja/base.framework
 public function getMessages()
 {
     $messages = array();
     foreach (parent::getMessages() as $message) {
         switch ($message->getType()) {
             case 'PresenceOf':
                 $messages[] = new Message(null, Constants::getMessageType()['Error'], String::format(CommonResources::getMessage('Msg_PresenceOf'), ConfigurationResources::getMessage($message->getField())));
                 break;
             default:
                 $messages[] = new Message(null, Constants::getMessageType()['Error'], $message->getMessage());
                 break;
         }
     }
     return $messages;
 }
コード例 #2
0
 /**
  * @param  identfier
  * @return the messages
  */
 public function delete($id)
 {
     $response = new Response();
     $entity = UserRepository::getById($id);
     $errMsg = UserRepository::delete($id);
     if ($errMsg) {
         throw new CustomException($errMsg, Constants::errorCode()['BadRequest']);
     } else {
         $response->messages[] = new Message(null, Constants::getMessageType()['Success'], String::format(CommonResources::getMessage('Msg_SuccessfullyDeleted'), CommonResources::getMessage('User'), $entity->name));
     }
     return $response;
 }