当前位置: 首页>>代码示例>>PHP>>正文


PHP Posts::getMessages方法代码示例

本文整理汇总了PHP中Posts::getMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP Posts::getMessages方法的具体用法?PHP Posts::getMessages怎么用?PHP Posts::getMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Posts的用法示例。


在下文中一共展示了Posts::getMessages方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addAction

 /**
  * Добавляет новую должность
  */
 public function addAction()
 {
     $result = array();
     $presentPost = \Posts::findFirst("title='" . $this->request->get("title") . "'");
     if ($presentPost != false) {
         $result['retcode'] = 1;
         $result['msgs'][] = "Посада із такою назвою вже існує!";
     } else {
         $namePost = new \Posts();
         $namePost->title = $this->request->get("title");
         if ($namePost->save() == false) {
             $result['retcode'] = 2;
             $result['msgs'][] = "Неможливо додати посаду \n";
             foreach ($namePost->getMessages() as $message) {
                 $result['msgs'][] = $message + "\n";
             }
         } else {
             $result['retcode'] = 0;
             $result['id'] = $namePost->id;
             $result['msgs'][] = "Нову посаду збережено";
         }
     }
     $this->view->disable();
     $this->response->setContentType('application/json', 'UTF-8');
     echo json_encode($result);
 }
开发者ID:sergeytkachenko,项目名称:angular-gulp-phalcon,代码行数:29,代码来源:PostsController.php

示例2: createAction

 public function createAction()
 {
     $post = new Posts();
     $success = $post->save($this->request->getPost(), array('id_posta', 'poruka', 'created_at'));
     if ($success) {
         echo "Your message has been posted !";
     } else {
         echo "Sorry, the following problems were generated: ";
         foreach ($post->getMessages() as $message) {
             echo $message->getMessage(), "<br/>";
         }
     }
     $this->view->disable();
 }
开发者ID:bblazina,项目名称:twitterclone,代码行数:14,代码来源:PostsController.php

示例3: createAction

 public function createAction()
 {
     $entity = new \Posts();
     $createForm = new AutoForm($entity);
     if ($this->request->isPost()) {
         $created = $entity->create($this->request->getPost());
         if (!$created) {
             foreach ($entity->getMessages() as $message) {
                 $this->flashSession->error($message);
             }
         }
         return $this->dispatcher->forward(['action' => 'index']);
     }
     $this->view->setVars(['testForm' => $createForm]);
 }
开发者ID:moaljazaery,项目名称:phalcon-module-admin,代码行数:15,代码来源:IndexController.php

示例4: create

 /**
  * Creates a new post
  */
 public function create($latitude, $longitude, $content, $user)
 {
     $post = new Posts();
     $post->users_id = $user->id;
     $post->latitude = $latitude;
     $post->longitude = $longitude;
     $post->content = $content;
     if ($post->save()) {
         return array(true, $post->toArray());
     } else {
         $errors = array();
         foreach ($post->getMessages() as $message) {
             $errors[] = (string) $message;
         }
         return array(false, $errors);
     }
 }
开发者ID:honerlaw,项目名称:archived-peekio,代码行数:20,代码来源:PostsComponent.php

示例5: savePostAction

 public function savePostAction()
 {
     $this->view->title = "Збереження посади";
     $errors = array();
     if ($this->request->isPost()) {
         $namePost = new \Posts();
         $namePost->title = $this->request->get("title");
         if ($namePost->save() == false) {
             echo "Неможливо додати посаду \n";
             foreach ($namePost->getMessages() as $message) {
                 echo $message, "\n";
             }
         } else {
             $response = new \Phalcon\Http\Response();
             $response->redirect("/methodist/stafflist/posts");
             return $response;
         }
     }
 }
开发者ID:sergeytkachenko,项目名称:angular-gulp-phalcon,代码行数:19,代码来源:StafflistController.php

示例6: createAction

 /**
  * Creates a new post
  */
 public function createAction()
 {
     if (!$this->request->isPost()) {
         return $this->dispatcher->forward(array("controller" => "posts", "action" => "index"));
     }
     $post = new Posts();
     $post->title = $this->request->getPost("title");
     $post->body = $this->request->getPost("body");
     $post->excerpt = $this->request->getPost("excerpt");
     $post->published = $this->request->getPost("published");
     $post->updated = $this->request->getPost("updated");
     $post->pinged = $this->request->getPost("pinged");
     $post->to_ping = $this->request->getPost("to_ping");
     if (!$post->save()) {
         foreach ($post->getMessages() as $message) {
             $this->flash->error($message);
         }
         return $this->dispatcher->forward(array("controller" => "posts", "action" => "new"));
     }
     $this->flash->success("post was created successfully");
     return $this->dispatcher->forward(array("controller" => "posts", "action" => "index"));
 }
开发者ID:jstacoder,项目名称:phlaskr-phalcon,代码行数:25,代码来源:PostsController.php

示例7: createAction

 /**
  * Creates a new post
  */
 public function createAction()
 {
     if (!$this->request->isPost()) {
         return $this->dispatcher->forward(array("controller" => "posts", "action" => "index"));
     }
     $post = new Posts();
     $postTags = array();
     $post->id = $this->request->getPost("id");
     $post->tags = $postTags;
     $post->users_id = $this->session->get("user_id");
     $post->title = $this->request->getPost("title");
     $post->body = $this->request->getPost("body");
     $post->excerpt = $this->request->getPost("excerpt");
     $post->pinged = $this->request->getPost("pinged");
     $post->to_ping = $this->request->getPost("to_ping");
     $success = $post->save();
     $tags = explode(",", $this->request->getPost("tags", array("trim", "lower")));
     $post->addTags($tags);
     if (!$success) {
         foreach ($post->getMessages() as $message) {
             $this->flash->error($message);
         }
         return $this->dispatcher->forward(array("controller" => "posts", "action" => "new"));
     }
     $this->sendPings();
     $this->flash->success("post was created successfully");
     return $this->dispatcher->forward(array("controller" => "posts", "action" => "index"));
 }
开发者ID:gn0st1k4m,项目名称:phalconBlog,代码行数:31,代码来源:PostsController.php


注:本文中的Posts::getMessages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。