class Argument (View source)

A controller argument

Properties

protected string $name

Name of this argument

protected string $dataType

Data type of this argument's value

protected bool $isRequired

true if this argument is required

protected object|null $value

Actual value of this argument

protected mixed $defaultValue

Default value. Used if argument is optional.

protected ValidatorInterface|null $validator

A custom validator, used supplementary to the base validation

protected Result $validationResults

The validation results. This can be asked if the argument has errors.

protected bool $mapRequestBody

If the request body should be mapped into this argument.

protected MvcPropertyMappingConfiguration $propertyMappingConfiguration
protected PropertyMapper $propertyMapper

Methods

__construct(string $name, string $dataType)

Constructs this controller argument

string
getName()

Returns the name of this argument

string
getDataType()

Returns the data type of this argument's value

setRequired(bool $required)

Marks this argument to be required

bool
isRequired()

Returns true if this argument is required

setDefaultValue(mixed $defaultValue)

Sets the default value of the argument

mixed
getDefaultValue()

Returns the default value of this argument

setValidator(ValidatorInterface $validator)

Sets a custom validator which is used supplementary to the base validation

ValidatorInterface|null
getValidator()

Returns the set validator

setValue(mixed $rawValue)

Sets the value of this argument.

object
getValue()

Returns the value of this argument. If the value is NULL, we use the defaultValue.

getPropertyMappingConfiguration()

Return the Property Mapping Configuration used for this argument; can be used by the initialize*action to modify the Property Mapping.

Result|null
getValidationResults()

No description

bool
getMapRequestBody()

No description

setMapRequestBody(bool $mapRequestBody)

Set if the request body should be mapped into this argument.

Details

__construct(string $name, string $dataType)

Constructs this controller argument

Parameters

string $name

Name of this argument

string $dataType

The data type of this argument

Exceptions

InvalidArgumentException

string getName()

Returns the name of this argument

Return Value

string

This argument's name

string getDataType()

Returns the data type of this argument's value

Return Value

string

The data type

Argument setRequired(bool $required)

Marks this argument to be required

Parameters

bool $required

true if this argument should be required

Return Value

Argument $this

bool isRequired()

Returns true if this argument is required

Return Value

bool

true if this argument is required

Argument setDefaultValue(mixed $defaultValue)

Sets the default value of the argument

Parameters

mixed $defaultValue

Default value

Return Value

Argument $this

mixed getDefaultValue()

Returns the default value of this argument

Return Value

mixed

The default value

Argument setValidator(ValidatorInterface $validator)

Sets a custom validator which is used supplementary to the base validation

Parameters

ValidatorInterface $validator

The actual validator object

Return Value

Argument

Returns $this (used for fluent interface)

ValidatorInterface|null getValidator()

Returns the set validator

Return Value

ValidatorInterface|null

The set validator, NULL if none was set

Argument setValue(mixed $rawValue)

Sets the value of this argument.

Parameters

mixed $rawValue

The value of this argument

Return Value

Argument $this

Exceptions

Exception
Exception

object getValue()

Returns the value of this argument. If the value is NULL, we use the defaultValue.

Return Value

object

The value of this argument - if none was set, the default value is returned

MvcPropertyMappingConfiguration getPropertyMappingConfiguration()

Return the Property Mapping Configuration used for this argument; can be used by the initialize*action to modify the Property Mapping.

Result|null getValidationResults()

No description

Return Value

Result|null

Validation errors which have occurred.

bool getMapRequestBody()

No description

Return Value

bool

Argument setMapRequestBody(bool $mapRequestBody)

Set if the request body should be mapped into this argument.

Parameters

bool $mapRequestBody

Return Value

Argument $this