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


PHP Route::save方法代码示例

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


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

示例1: create

 /**
  * Create the application document registry
  *
  * @param array $aData
  * @return string
  *
  */
 public function create($aData)
 {
     $oConnection = Propel::getConnection(RoutePeer::DATABASE_NAME);
     try {
         $sRouteUID = G::generateUniqueID();
         $aData['ROU_UID'] = $sRouteUID;
         $oRoute = new Route();
         // validating default values
         $aData['ROU_TO_LAST_USER'] = $this->validateValue(isset($aData['ROU_TO_LAST_USER']) ? $aData['ROU_TO_LAST_USER'] : '', array('TRUE', 'FALSE'), 'FALSE');
         $aData['ROU_OPTIONAL'] = $this->validateValue(isset($aData['ROU_OPTIONAL']) ? $aData['ROU_OPTIONAL'] : '', array('TRUE', 'FALSE'), 'FALSE');
         $aData['ROU_SEND_EMAIL'] = $this->validateValue(isset($aData['ROU_SEND_EMAIL']) ? $aData['ROU_SEND_EMAIL'] : '', array('TRUE', 'FALSE'), 'TRUE');
         $oRoute->fromArray($aData, BasePeer::TYPE_FIELDNAME);
         if ($oRoute->validate()) {
             $oConnection->begin();
             $iResult = $oRoute->save();
             $oConnection->commit();
             return $sRouteUID;
         } else {
             $sMessage = '';
             $aValidationFailures = $oRoute->getValidationFailures();
             foreach ($aValidationFailures as $oValidationFailure) {
                 $sMessage .= $oValidationFailure->getMessage() . '<br />';
             }
             throw new Exception('The registry cannot be created!<br />' . $sMessage);
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
开发者ID:bqevin,项目名称:processmaker,代码行数:37,代码来源:Route.php

示例2: save

 /**
  * Save this walk to the database
  * Also saves any route attached to the walk
  */
 public function save()
 {
     $db = JFactory::getDbo();
     // Commit everything as one transaction
     $db->transactionStart();
     $query = $db->getQuery(true);
     // First, do the basic fields
     foreach ($this->dbmappings as $var => $dbField) {
         $query->set($dbField . " = '" . $db->escape($this->{$var}) . "'");
     }
     $query->set("suggestedby = " . $this->suggestedBy->id);
     // Update or insert?
     if (!isset($this->id)) {
         $query->insert("walks");
     } else {
         $query->where("ID = " . (int) $this->id);
         $query->update("walks");
     }
     $db->setQuery($query);
     $db->query();
     if (!isset($this->id)) {
         // Get the ID from the database
         $this->id = $db->insertid();
     }
     // TODO: Handle failure
     // Commit the transaction - the route is not a critical part of the walk
     $db->transactionCommit();
     // Now save the route
     if (isset($this->route)) {
         $this->route->save();
     }
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:36,代码来源:Walk.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $route = new Route();
     $route->name = $request['name'];
     $route->distance = $request['distance'];
     $route->duration = $request['duration'];
     $route->price = $request['price'];
     $route->save();
 }
开发者ID:gokigoks,项目名称:ontheway_webservice,代码行数:14,代码来源:RouteController.php

示例4: insert_routes

 public function insert_routes(Request $request)
 {
     $route = new Route();
     $route->route_name = $request->input('name');
     $route->start = $request->input('start');
     $route->end = $request->input('end');
     $route->rep_id = $request->input('rep');
     $route->remarks = $request->input('remarks');
     $route->save();
 }
开发者ID:nilesh93,项目名称:Distribution_Management_System,代码行数:10,代码来源:RouteController.php

示例5: seeder

 public function seeder()
 {
     //adding new route
     $route = new Route();
     $route->name = '/login';
     $route->save();
     //adding a method to route
     $method = $route->methods()->create(['tags' => 'customer', 'method' => 'POST', 'description' => 'Post operation on customer route']);
     //adding parameters to method
     $method->parameters()->create(['name' => 'mobile', 'in' => 'formData', 'description' => 'mobile number of customer', 'required' => true, 'type' => 'string']);
     $method->parameters()->create(['name' => 'password', 'in' => 'formData', 'description' => 'password of customer', 'required' => true, 'type' => 'string']);
     return true;
 }
开发者ID:ritesrnjn,项目名称:api_docs,代码行数:13,代码来源:seed.php

示例6: addapi

 public function addapi()
 {
     if (isset($_POST) == true && empty($_POST) == false) {
         $api = $_POST['api'];
         $methodName = $_POST['method'];
         $tags = $_POST['tags'] ? $_POST['tags'] : 'default';
         $description = $_POST['description'] ? $_POST['description'] : ' ';
         $BX_NAME = $_POST['BX_NAME'];
         $BX_TYPE = $_POST['BX_TYPE'];
         $BX_CHK = $_POST['BX_CHK'];
         $BX_DESCRIPTION = $_POST['BX_DESCRIPTION'];
         $BX_IN = $_POST['BX_IN'];
         $param_count = count($BX_NAME);
         //check if route already exists
         $route = Route::where('name', '=', $api)->first();
         if (!$route) {
             //adding new route
             $route = new Route();
             $route->name = $api;
             $route->save();
         }
         $method = $route->methods()->where('method', '=', $methodName)->firstOrCreate(['tags' => $tags, 'method' => $methodName, 'description' => $description]);
         //parameters
         //if blank field submitted in parameter don't add it
         for ($i = 0; $i < $param_count; $i++) {
             if ($BX_NAME[$i] != '') {
                 $BX_CHK[$i] = 'on' ? true : false;
                 $BX_DESCRIPTION[$i] = $BX_DESCRIPTION[$i] ? $BX_DESCRIPTION[$i] : ' ';
                 $method->parameters()->create(['name' => $BX_NAME[$i], 'in' => $BX_IN[$i], 'description' => $BX_DESCRIPTION[$i], 'required' => $BX_CHK[$i], 'type' => $BX_TYPE[$i]]);
             }
             //END if
         }
         //for
         header('location: ' . URL . '/show');
     } else {
         header('location: ' . URL . '/show');
     }
     //if-else post
 }
开发者ID:ritesrnjn,项目名称:api_docs,代码行数:39,代码来源:create.php

示例7: actionAddInfo

 public function actionAddInfo()
 {
     $source = '';
     $thumb = '';
     if (isset($_POST['source'])) {
         $source = $_POST['source'];
     }
     if (isset($_POST['thumb'])) {
         $thumb = $_POST['thumb'];
     }
     $route = new Route();
     $route->name = $_POST['title'];
     $route->area = $_POST['area'];
     $route->port = $_POST['port'];
     $route->style = $_POST['style'];
     $route->company = $_POST['company'];
     $route->source = $source;
     $route->thumb = $thumb;
     $route->description = $_POST['description'];
     $route->start_time = $_POST['date'];
     $route->continent = $_POST['continent'];
     $route->save();
     echo 1;
 }
开发者ID:rocketyang,项目名称:yii2,代码行数:24,代码来源:RouteController.php

示例8: setPath

 /**
  * Sets the Route's path field
  * @param int $path [optional]
  * @return bool
  */
 public function setPath($path, $load = true)
 {
     # Prepare
     $save = false;
     # Prepare
     $path = trim($path, '/');
     if (empty($path)) {
         return false;
     }
     # Update
     if ($this->Route_id) {
         $Route = $this->Route;
     } else {
         $Route = new Route();
         $Route->type = 'content';
         $Route->data = array('id' => $this->id);
         $this->Route = $Route;
         $save = true;
     }
     # Apply
     if ($Route->path != $path) {
         $Route->path = $path;
         $Route->save();
         # Update Children
         $Children = $this->Children;
         foreach ($Children as $Child) {
             $Child->setPath($path . '/' . $Child->code);
         }
     }
     # Done
     return $save;
 }
开发者ID:balupton,项目名称:balcms,代码行数:37,代码来源:Content.php


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