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


PHP Tags::getMessages方法代码示例

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


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

示例1: createAction

 /**
  * Creates a new tag
  */
 public function createAction()
 {
     if (!$this->request->isPost()) {
         return $this->dispatcher->forward(array("controller" => "tags", "action" => "index"));
     }
     $tag = new Tags();
     $tag->id = $this->request->getPost("id");
     $tag->tag = $this->request->getPost("tag");
     if (!$tag->save()) {
         foreach ($tag->getMessages() as $message) {
             $this->flash->error($message);
         }
         return $this->dispatcher->forward(array("controller" => "tags", "action" => "new"));
     }
     $this->flash->success("tag was created successfully");
     return $this->dispatcher->forward(array("controller" => "tags", "action" => "index"));
 }
开发者ID:gn0st1k4m,项目名称:phalconBlog,代码行数:20,代码来源:TagsController.php

示例2: newAction

 public function newAction()
 {
     $response = new ApiResponse();
     if ($this->request->isPost()) {
         $tag = new Tags();
         $tag->id = uniqid();
         $tag->name = $this->request->getPost('name');
         if ($this->request->hasFiles() == true) {
             $baseLocation = 'files/';
             foreach ($this->request->getUploadedFiles() as $file) {
                 $photos = new Photos();
                 $unique_filename = $tag->id;
                 $photos->size = $file->getSize();
                 $photos->original_name = $file->getName();
                 $photos->file_name = $unique_filename;
                 $photos->extension = $file->getExtension();
                 $location = $baseLocation . $unique_filename . "." . $file->getExtension();
                 $photos->public_link = $location;
                 try {
                     if (!$photos->save()) {
                         $response->setResponseError($photos->getMessages());
                     } else {
                         //Move the file into the application
                         $file->moveTo($location);
                         $tag->icon = $photos->public_link;
                     }
                 } catch (PDOException $e) {
                     $response->setResponseError($e->getMessage());
                 }
             }
         }
         try {
             if ($tag->save() == false) {
                 $response->setResponseError($tag->getMessages());
             } else {
                 $response->setResponseMessage($tag->id);
             }
         } catch (PDOException $e) {
             $response->setResponseError($e->getMessage());
         }
     } else {
         $response->setResponseError('Wrong HTTP Method');
     }
     return $response;
 }
开发者ID:nvg58,项目名称:uethackathon2015_team08server,代码行数:45,代码来源:TagController.php

示例3: foreach

  * 3) Saving the imageTag
  */
 foreach ($data as $tagRow) {
     $name = $filter->sanitize($tagRow['name'], 'string');
     //Get tag if it exists already
     $tag = Tags::findFirst("name = '" . $name . "' AND category_id = '" . $tagRow['category_id'] . "'");
     if (!$tag) {
         $tag = new Tags();
     }
     $tag->name = $name;
     $tag->category_id = $tagRow['category_id'];
     //If the tag could not be saved, dump the error messages
     if (!$tag->save()) {
         echo 'could not save tag.';
         var_dump($tagRow);
         var_dump($tag->getMessages());
         $app->response->setStatusCode('500');
         $app->response->send();
     }
     $tag->refresh();
     //Create an imageTag for each tag
     $imagesTags = new ImagesTags();
     $imagesTags->tag_id = $tag->id;
     $imagesTags->image_id = $image->id;
     $imagesTags->x = $tagRow['x'];
     $imagesTags->y = $tagRow['y'];
     $imagesTags->user_id = $user->getFbId();
     //If the imageTag could not be saved, dump the error message
     if (!$imagesTags->save()) {
         var_dump($imagesTags->getMessages());
         $app->response->setStatusCode('500');
开发者ID:stumpdk,项目名称:hack4dk_DR_images,代码行数:31,代码来源:index.php


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