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


PHP RequiredFields::getFields方法代码示例

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


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

示例1: put

 public function put($id = null)
 {
     if (empty($id)) {
         new Error("Safety Check ID cannot be empty");
     }
     $fields = array();
     parse_str(file_get_contents("php://input"), $fields);
     $result = RequiredFields::getFields(array('completed' => array('required' => true, 'regex' => '/^(0|1)$/')), $fields);
     $fields = array();
     foreach ($result['data'] as $key => $value) {
         if (!empty($key) && !empty($value)) {
             $fields[$key] = $value;
         }
     }
     if (0 < count($fields)) {
         $this->db->prepareUpdate($fields);
         if ($this->db->update($this->tableName, $id)) {
             $this->get($id);
         } else {
             new Error("Could not update safety check");
         }
     } else {
         new Error("No values to update");
     }
 }
开发者ID:BradlySharpe,项目名称:Sharpies-Auto-Services,代码行数:25,代码来源:SafetyCheck.php

示例2: put

 public function put($customerId = null, $carId = null)
 {
     if (empty($carId)) {
         new Error("Car ID cannot be empty");
     }
     $fields = array();
     parse_str(file_get_contents("php://input"), $fields);
     $result = RequiredFields::getFields(array('owner' => array('regex' => '/^\\d+$/'), 'make' => array('regex' => '/^.{1,100}$/'), 'model' => array('regex' => '/^.{1,100}$/'), 'registration' => array('regex' => '/^[A-Z0-9]{1,6}$/')), $fields);
     $fields = array();
     foreach ($result['data'] as $key => $value) {
         if (!empty($key) && !empty($value)) {
             $fields[$key] = $value;
         }
     }
     if (0 < count($fields)) {
         $this->db->prepareUpdate($fields);
         if ($this->db->update($this->tableName, $carId)) {
             $this->get(array_key_exists('owner', $fields) ? $fields['owner'] : $customerId, $carId);
         } else {
             new Error("Could not update customer");
         }
     } else {
         new Error("No values to update");
     }
 }
开发者ID:BradlySharpe,项目名称:Sharpies-Auto-Services,代码行数:25,代码来源:Car.php

示例3: put

 public function put($id = null)
 {
     if (empty($id)) {
         new Error("Customer ID cannot be empty");
     }
     $fields = array();
     parse_str(file_get_contents("php://input"), $fields);
     $result = RequiredFields::getFields(array('firstname' => array('regex' => '/^.{1,30}$/'), 'lastname' => array('regex' => '/^.{1,30}$/'), 'address' => array('regex' => '/^.{1,100}$/'), 'city' => array('regex' => '/^.{1,50}$/'), 'state' => array('regex' => '/^.{1,20}$/'), 'postcode' => array('regex' => '/^\\d{4}$/')), $fields);
     $fields = array();
     foreach ($result['data'] as $key => $value) {
         if (!empty($key) && !empty($value)) {
             $fields[$key] = $value;
         }
     }
     if (0 < count($fields)) {
         $this->db->prepareUpdate($fields);
         if ($this->db->update($this->tableName, $id)) {
             $this->get($id);
         } else {
             new Error("Could not update customer");
         }
     } else {
         new Error("No values to update");
     }
 }
开发者ID:BradlySharpe,项目名称:Sharpies-Auto-Services,代码行数:25,代码来源:Customer.php

示例4: put

 public function put($id = null)
 {
     if (empty($id)) {
         new Error("Item ID cannot be empty");
     }
     $fields = array();
     parse_str(file_get_contents("php://input"), $fields);
     $result = RequiredFields::getFields(array('invoice' => array('regex' => '/^\\d+$/'), 'amount' => array('regex' => '/^([\\d]*\\.[\\d]+|[\\d]+)$/'), 'comment' => array(), 'date' => array('regex' => '/^2\\d{3}\\-[01]\\d\\-[0-3]\\d$/')), $fields);
     $fields = array();
     foreach ($result['data'] as $key => $value) {
         if (!empty($key) && !empty($value)) {
             $fields[$key] = $value;
         }
     }
     if (0 < count($fields)) {
         $this->db->prepareUpdate($fields);
         if ($this->db->update($this->tableName, $id)) {
             $this->get($id);
         } else {
             new Error("Could not update payment");
         }
     } else {
         new Error("No values to update");
     }
 }
开发者ID:BradlySharpe,项目名称:Sharpies-Auto-Services,代码行数:25,代码来源:Payment.php

示例5: put

 public function put($id = null)
 {
     if (empty($id)) {
         new Error("Item ID cannot be empty");
     }
     $fields = array();
     parse_str(file_get_contents("php://input"), $fields);
     $result = RequiredFields::getFields(array('description' => array('regex' => '/^.{1,100}$/'), 'defaultCost' => array('regex' => '/^[-+]?([\\d]*\\.[\\d]+|[\\d]+)$/'), 'defaultQuantity' => array('regex' => '/^[-+]?([\\d]*\\.[\\d]+|[\\d]+)$/'), 'comment' => array('regex' => '/^(0|1)$/'), 'active' => array('regex' => '/^(0|1)$/')), $fields);
     $fields = array();
     foreach ($result['data'] as $key => $value) {
         if (!empty($key) && !empty($value)) {
             $fields[$key] = $value;
         }
     }
     if (0 < count($fields)) {
         $this->db->prepareUpdate($fields);
         if ($this->db->update($this->tableName, $id)) {
             $this->get($id);
         } else {
             new Error("Could not update item");
         }
     } else {
         new Error("No values to update");
     }
 }
开发者ID:BradlySharpe,项目名称:Sharpies-Auto-Services,代码行数:25,代码来源:Item.php

示例6: post

 public function post()
 {
     $result = RequiredFields::getFields(array('owner' => array('required' => true, 'regex' => '/^\\d+$/'), 'car' => array('required' => true, 'regex' => '/^\\d+$/'), 'odo' => array('required' => true, 'regex' => '/^\\d{1,6}$/'), 'safetyCheck' => array('required' => true, 'regex' => '/^\\d+$/')), $_POST);
     if ($result['error']) {
         new Error("Invalid values passed", $result['data']);
     } else {
         $this->db->prepareInsert($result['data']);
         if ($this->db->insert($this->tableName)) {
             $this->get($this->db->lastId());
         } else {
             new Error("Error inserting service record");
         }
     }
 }
开发者ID:BradlySharpe,项目名称:Sharpies-Auto-Services,代码行数:14,代码来源:Service.php

示例7: post

 public function post()
 {
     $result = RequiredFields::getFields(array('service' => array('required' => true, 'regex' => '/^\\d+$/'), 'bankDetails' => array('regex' => '/^(0|1)$/')), $_POST);
     if ($result['error']) {
         new Error("Invalid values passed", $result['data']);
     } else {
         $this->db->prepareInsert($result['data']);
         if ($this->db->insert($this->tableName)) {
             $this->get($this->db->lastId());
             //new Respond(array('id' => $this->db->lastId()));
         } else {
             new Error("Error inserting customer record");
         }
     }
 }
开发者ID:BradlySharpe,项目名称:Sharpies-Auto-Services,代码行数:15,代码来源:Invoice.php


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