/** * @return void */ public function Validate() { if (empty($this->attributes)) { $this->isValid = true; return; } $result = $this->service->Validate($this->category, $this->attributes, $this->entityId, $this->ignoreEmpty); $this->isValid = $result->IsValid(); $this->messages = $result->Errors(); }
/** * @param ReservationSeries $reservationSeries * @return ReservationRuleResult */ public function Validate($reservationSeries) { $resources = Resources::GetInstance(); $errorMessage = new StringBuilder(); $result = $this->attributeService->Validate(CustomAttributeCategory::RESERVATION, $reservationSeries->AttributeValues()); $isValid = $result->IsValid(); foreach ($result->Errors() as $error) { $errorMessage->AppendLine($error); } if (!$isValid) { $errorMessage->PrependLine($resources->GetString('CustomAttributeErrors')); } return new ReservationRuleResult($isValid, $errorMessage->ToString()); }