Example #1
0
 /**
  * @param $parameter
  * @param $value
  * @return bool
  * @throws FREST\Exception
  */
 protected function isValidURLParameter($parameter, $value)
 {
     /** @noinspection PhpUndefinedClassInspection */
     $isValid = parent::isValidURLParameter($parameter, $value);
     if (!$isValid) {
         // if not already determined to be valid
         $createSettings = $this->resource->getCreateSettings();
         if (isset($createSettings[$parameter])) {
             /** @var Setting\Create $createSetting */
             $createSetting = $createSettings[$parameter];
             $fieldSetting = $this->resource->getFieldSettingForAlias($createSetting->getAlias());
             if (!isset($fieldSetting)) {
                 throw new FREST\Exception(FREST\Exception::Config, "No field setting found for condition '{$parameter}' in resource {$this->resource->getName()}");
             }
             $isValid = TRUE;
         }
     }
     return $isValid;
 }
Example #2
0
 /**
  * @param $parameter
  * @param $value
  * 
  * @return bool
  * @throws FREST\Exception
  */
 protected function isValidURLParameter($parameter, $value)
 {
     /** @noinspection PhpUndefinedClassInspection */
     $isValid = parent::isValidURLParameter($parameter, $value);
     // if not already determined valid
     if (!$isValid) {
         if ($parameter == 'fields') {
             if (!$this->getWasInternallyLoaded()) {
                 if (!$this->resource->getAllowFieldsParameter()) {
                     throw new FREST\Exception(FREST\Exception::FieldsParameterNotAllowed);
                 }
                 if (!$this->resource->getAllowPartialSyntax() && (strpos($value, '{') !== FALSE || strpos($value, '}') !== FALSE)) {
                     throw new FREST\Exception(FREST\Exception::PartialSyntaxNotAllowed);
                 }
             }
             $isValid = TRUE;
         }
     }
     return $isValid;
 }