本文整理汇总了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();
}
示例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;
}
示例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;
}
示例4: validate
protected function validate()
{
$result = parent::validate();
if (!$this->getBuildTaskObject()) {
$result->error("Please select a valid Build Task.");
}
return $result;
}
示例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;
}
示例6: validate
public function validate()
{
$result = parent::validate();
if ($this->ProductOptionGroupID == 0) {
$result->error('Must set a Group prior to saving');
}
return $result;
}
示例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;
}
示例8: validate
public function validate()
{
$result = parent::validate();
if (!$this->Title) {
$result->error("Menu group must have a title.");
}
return $result;
}
示例9: validate
public function validate()
{
$result = parent::validate();
if (!$this->Value) {
$result->error('Each select option must have a value.');
}
return $result;
}
示例10: validate
public function validate()
{
$result = parent::validate();
if (intval($this->TargetFieldID) <= 0) {
$result->error('you need to specify a target field!');
}
return $result;
}
示例11: validate
public function validate()
{
$validation = parent::validate();
if (!$this->validTheme($this->Theme)) {
$validation->error("Invalid Theme: " . $this->Theme);
}
return $validation;
}
示例12: validate
public function validate()
{
$result = parent::validate();
if (!$this->Name) {
$result->error('"Name" can\'t be blank');
}
return $result;
}
示例13: validate
public function validate()
{
$valid = parent::validate();
if (trim($this->Title) == '') {
$valid->error('Please give your article a title');
}
return $valid;
}
示例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;
}
示例15: validate
function validate()
{
if (!$this->Title) {
return new ValidationResult(false, 'Title is required');
} else {
return parent::validate();
}
}