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


PHP DataObject::validate方法代码示例

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


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

示例1: validate

 protected function validate()
 {
     $this->beforeExtending('validate', function ($result) {
         $this->validSlug($result);
     });
     return parent::validate();
 }
开发者ID:milkyway-multimedia,项目名称:ss-linkable-menus,代码行数:7,代码来源:LinkableMenu.php

示例2: validate

 /**
  * @return ValidationResult
  */
 protected function validate()
 {
     $valid = parent::validate();
     if (!$valid->valid()) {
         return $valid;
     }
     $type = trim($this->Type);
     if (empty($type)) {
         return $valid->error('Type is required!');
     }
     switch ($type) {
         case 'Persons':
             $this->Unit = 'units';
             break;
         case 'CO2':
             $this->Unit = 'ppm';
             break;
         case 'Temperature':
             $this->Unit = '°F';
             break;
         case 'Humidity':
             $this->Unit = '%';
             break;
     }
     $endpoint = trim($this->Endpoint);
     if (empty($endpoint)) {
         return $valid->error('Endpoint URL is required!');
     }
     if (filter_var($endpoint, FILTER_VALIDATE_URL) === FALSE) {
         return $valid->error('Endpoint URL is not a valid URL!');
     }
     return $valid;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:36,代码来源:RoomMetricType.php

示例3: validate

 /**
  * @return ValidationResult
  *
  * TODO implement validation to ensure values aren't duplicated in multiple tiers
  */
 public function validate()
 {
     $result = parent::validate();
     /*$tierQuantity = ProductDiscountTier::get()
     			->filter(
     				array(
     					'ProductDiscountID' => $this->ProductDiscountID,
     					'Quantity' => $this->Quantity
     				)
     			)->first();
     
     		$tierPercentage = ProductDiscountTier::get()
     			->filter(
     				array(
     					'ProductDiscountID' => $this->ProductDiscountID,
     					'Percentage' => $this->Percentage
     				)
     			)->first();
     
     		if($tierQuantity->ID != 0 && $tierQuantity->ID != $this->ID){
     			$result->error($this->Quantity." is already used in another discount tier. Please use a different quantity");
     		}
     		if($tierPercentage->ID != 0 && $tierPercentage->ID != $this->ID){
     			$result->error($this->Percentage." is already used in another discount tier. Please use a different percentage");
     		}*/
     return $result;
 }
开发者ID:helpfulrobot,项目名称:dynamic-foxystripe,代码行数:32,代码来源:ProductDiscountTier.php

示例4: validate

 protected function validate()
 {
     $result = parent::validate();
     if (!$this->getBuildTaskObject()) {
         $result->error("Please select a valid Build Task.");
     }
     return $result;
 }
开发者ID:tim-lar,项目名称:silverstripe-queuedjobs,代码行数:8,代码来源:QueuedTask.php

示例5: validate

 public function validate()
 {
     $result = parent::validate();
     /*if($this->Country == 'DE' && $this->Postcode && strlen($this->Postcode) != 5) {
     			$result->error('Need five digits for German postcodes');
     		}*/
     return $result;
 }
开发者ID:helpfulrobot,项目名称:dynamic-foxystripe,代码行数:8,代码来源:OrderDetail.php

示例6: validate

 public function validate()
 {
     $result = parent::validate();
     if ($this->ProductOptionGroupID == 0) {
         $result->error('Must set a Group prior to saving');
     }
     return $result;
 }
开发者ID:helpfulrobot,项目名称:dynamic-foxystripe,代码行数:8,代码来源:OptionItem.php

示例7: validate

 public function validate()
 {
     $result = parent::validate();
     if (Catalogue::get()->filter(array('Video_title' => $this->Video_Title))->first()) {
         $result->error('This media has already been inserted to the catalogue.');
     }
     return $result;
 }
开发者ID:jareddreyer,项目名称:catalogue,代码行数:8,代码来源:Form.php

示例8: validate

 public function validate()
 {
     $result = parent::validate();
     if (!$this->Title) {
         $result->error("Menu group must have a title.");
     }
     return $result;
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-shop-menu,代码行数:8,代码来源:Menu.php

示例9: validate

 public function validate()
 {
     $result = parent::validate();
     if (!$this->Value) {
         $result->error('Each select option must have a value.');
     }
     return $result;
 }
开发者ID:phill-m,项目名称:silverstripe-metadata,代码行数:8,代码来源:MetadataSelectFieldOption.php

示例10: validate

 public function validate()
 {
     $result = parent::validate();
     if (intval($this->TargetFieldID) <= 0) {
         $result->error('you need to specify a target field!');
     }
     return $result;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:8,代码来源:AbstractSurveyMigrationMapping.php

示例11: validate

 public function validate()
 {
     $validation = parent::validate();
     if (!$this->validTheme($this->Theme)) {
         $validation->error("Invalid Theme: " . $this->Theme);
     }
     return $validation;
 }
开发者ID:SpiritLevel,项目名称:silverstripe-nivoslider,代码行数:8,代码来源:NivoSlider.php

示例12: validate

 public function validate()
 {
     $result = parent::validate();
     if (!$this->Name) {
         $result->error('"Name" can\'t be blank');
     }
     return $result;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-frameworktest,代码行数:8,代码来源:Employee.php

示例13: validate

 public function validate()
 {
     $valid = parent::validate();
     if (trim($this->Title) == '') {
         $valid->error('Please give your article a title');
     }
     return $valid;
 }
开发者ID:axllent,项目名称:silverstripe-news,代码行数:8,代码来源:NewsArticle.php

示例14: validate

 public function validate()
 {
     $result = parent::validate();
     if ($this->Type == 'Limited' && !$this->Quantity) {
         $result->error('You must enter a quantity for limited resources.');
     }
     return $result;
 }
开发者ID:textagroup,项目名称:silverstripe-eventresources,代码行数:8,代码来源:EventResource.php

示例15: validate

 function validate()
 {
     if (!$this->Title) {
         return new ValidationResult(false, 'Title is required');
     } else {
         return parent::validate();
     }
 }
开发者ID:normann,项目名称:silverstripe-frameworktest,代码行数:8,代码来源:Company.php


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