Neomerx\JsonApi\Exceptions\ErrorCollection::addQueryParameterError PHP Method

addQueryParameterError() public method

public addQueryParameterError ( string $name, string $title, string | null $detail = null, integer | string | null $status = null, integer | string | null $idx = null, Neomerx\JsonApi\Contracts\Document\LinkInterface $aboutLink = null, integer | string | null $code = null, mixed | null $meta = null )
$name string
$title string
$detail string | null
$status integer | string | null
$idx integer | string | null
$aboutLink Neomerx\JsonApi\Contracts\Document\LinkInterface
$code integer | string | null
$meta mixed | null
    public function addQueryParameterError($name, $title, $detail = null, $status = null, $idx = null, LinkInterface $aboutLink = null, $code = null, $meta = null)
    {
        $source = [Error::SOURCE_PARAMETER => $name];
        $error = new Error($idx, $aboutLink, $status, $code, $title, $detail, $source, $meta);
        $this->add($error);
        return $this;
    }

Usage Example

 /**
  * @param ErrorCollection             $errors
  * @param EncodingParametersInterface $parameters
  */
 protected function checkUnrecognized(ErrorCollection $errors, EncodingParametersInterface $parameters)
 {
     if ($this->allowUnrecognized === false && empty($parameters->getUnrecognizedParameters()) === false) {
         foreach ($parameters->getUnrecognizedParameters() as $name => $value) {
             $errors->addQueryParameterError($name, T::t('Parameter is not allowed.'));
         }
     }
 }
All Usage Examples Of Neomerx\JsonApi\Exceptions\ErrorCollection::addQueryParameterError