class Controller extends DefaultController (View source)

Traits

Trait ApplicationAwareTrait A trait used with ApplicationAwareInterface

Properties

protected Application $app from  ApplicationAwareTrait
$helpers
protected array $sets

The values to be sent to views.

from  AbstractController
protected string|null $action

The action to be performed.

from  AbstractController
protected Request|null $request

The current request instance.

from  AbstractController
protected array|null $parameters

The action parameters.

from  AbstractController
protected EntityManager $entityManager from  Controller
protected Key|null $attributeKey from  Controller
protected AbstractValue $attributeValue from  Controller
protected $searchIndexFieldDefinition from  DefaultController
protected false|array $requestArray from  Controller
protected $akTextareaDisplayMode
protected $akTextareaDisplayModeCustomOptions

Methods

setApplication(Application $app)

Setter method for the application

__construct(EntityManager $entityManager)

No description

Request
getRequest()

Get the current request instance.

setRequest(Request $request)

Set the current request instance.

requireAsset()

Add an asset required in views.

addHeaderItem(string $item)

Adds an item to the view's header. This item will then be automatically printed out before the section of the page.

addFooterItem(string $item)

Adds an item to the view's footer. This item will then be automatically printed out before the section of the page.

set(string $key, mixed $val)

Set a value to be sent to the view.

array
getSets()

Get the values to be sent to views.

bool
shouldRunControllerTask()

Should the action be executed? Override this method to answer something different than true.

array
getHelperObjects()

Get the the helpers that will be be automatically sent to Views as variables.

mixed
get(string|null $key = null, mixed $defaultValue = null)

Get the whole $_GET array or a specific querystring value.

getTask() deprecated

No description

string|null
getAction()

Get the action to be performed.

array|null
getParameters()

Get the action parameters.

on_start()

Override this method to perform controller initializations.

on_before_render()

Override this method to do something right before the view is rendered.

isPost() deprecated

No description

mixed
post($field = false, mixed $defaultValue = null)

Get the whole $_POST array or a specific posted value.

redirect() deprecated

Redirect the clients to a specific URL/page (specify path(s) as argument(s) of this function).

runTask(mixed $action, mixed $parameters) deprecated

No description

mixed
runAction(string $action, array $parameters = [])

Perform an action of this controller (if shouldRunControllerTask returns true).

mixed
request($field = false)

Get the whole $_REQUEST array or a specific requested value.

__destruct()

No description

getIconFormatter()

Return a formatter object that provides an icon that will be shown in the list of attributes.

setAttributeType($attributeType)

No description

getAttributeType()

Returns a Type entity.

string|null
getAttributeTypeFileURL(string $_file)

No description

validateKey(array|false $data = false)

No description

string
getAttributeKeySettingsClass()

No description

mixed
setAttributeKey($attributeKey)

No description

getAttributeKey()

Returns a Key entity.

saveKey(array $data)

This method is called any time an attribute key is created or updated.

duplicateKey(mixed $newAK)

No description

deleteKey()

No description

string
getAttributeValueClass()

Is used to determine the name of the entity used to store the attribute value.

setAttributeValue(AbstractValue|null $attributeValue)

No description

getAttributeValue()

Get Attribute Value object.

getAttributeValueObject()

No description

createDefaultAttributeValue()

Create the default attribute value (if needed).

createAttributeValueFromRequest()

Is run when an attribute is saved through the standard user interfaces like the sitemap attributes dialog, the attributes panel, or the user attributes slideouts.

createAttributeValue($value)

Is run whenever $object->setAttribute('my_property_location_attribute', $value) is run through code, with whatever you happen to pass through.

deleteValue()

No description

array|null
string|int
getSearchIndexValue()

This value will be used by the search index.

string|null
searchKeywords(mixed $keywords, QueryBuilder $queryBuilder)

No description

filterByAttribute(AttributedItemList $list, mixed $value, string $comparison = '=')

No description

importKey(SimpleXMLElement $akey)

No description

mixed
exportKey($akey)

No description

mixed
importValue(SimpleXMLElement $akv)

No description

mixed
getDisplayValue()

For a DateTime implementation this could for example mean that the value is formatted and localized.

getView()

No description

string
field(string $fieldName)

No description

string
getControlID()

Get the ID to use for label elements. Not applicable in form views that do not contain

string
getLabelID() deprecated

Get the ID to use for label elements.

label(string|bool $customText = false) deprecated

No description

setRequestArray(array|false $array)

No description

bool
requestFieldExists()

No description

setupAndRun(string $method)

No description

saveForm(mixed $data) deprecated

No description

saveValue(mixed $mixed) deprecated

No description

getAttributeValueID() deprecated

No description

Settings|null
retrieveAttributeKeySettings()

No description

form()

No description

searchForm($list)

No description

search()

No description

validateValue()

No description

validateForm($data)

No description

string
getAttributeValueTextRepresentation()

Get a string containing the text representation of the attribute value currently set in the controller.

updateAttributeValueFromTextRepresentation(string $textRepresentation, ErrorList $warnings)

Update or create the attribute value starting from its text representation.

getValue()

No description

composer()

No description

type_form()

No description

load()

No description

Details

setApplication(Application $app)

Setter method for the application

Parameters

Application $app

__construct(EntityManager $entityManager)

No description

Parameters

EntityManager $entityManager

Request getRequest()

Get the current request instance.

Return Value

Request

setRequest(Request $request)

Set the current request instance.

Parameters

Request $request

requireAsset()

Add an asset required in views.

This function accept the same parameters as the requireAsset method of the ResponseAssetGroup.

See also

ResponseAssetGroup::requireAsset

addHeaderItem(string $item)

Adds an item to the view's header. This item will then be automatically printed out before the section of the page.

Parameters

string $item

addFooterItem(string $item)

Adds an item to the view's footer. This item will then be automatically printed out before the section of the page.

Parameters

string $item

set(string $key, mixed $val)

Set a value to be sent to the view.

Parameters

string $key

The name of the value

mixed $val

The value

array getSets()

Get the values to be sent to views.

Return Value

array

bool shouldRunControllerTask()

Should the action be executed? Override this method to answer something different than true.

Return Value

bool

array getHelperObjects()

Get the the helpers that will be be automatically sent to Views as variables.

Array keys are the variable names, array values are the helper instances.

Return Value

array

mixed get(string|null $key = null, mixed $defaultValue = null)

Get the whole $_GET array or a specific querystring value.

Parameters

string|null $key

set to null to get the whole $_GET array, or a string to get a specific value in the controller sets or from the querystring parameters

mixed $defaultValue

what to return if $key is specified but it does not exist neither in the sets nor in the querystring

Return Value

mixed

getTask() deprecated

deprecated use the getAction() method

No description

string|null getAction()

Get the action to be performed.

Return Value

string|null

array|null getParameters()

Get the action parameters.

Return Value

array|null

on_start()

Override this method to perform controller initializations.

on_before_render()

Override this method to do something right before the view is rendered.

For instance, you can call $this->set('variableName', $variableValue) to send the view additional sets.

isPost() deprecated

deprecated Use $this->getRequest()->isPost();

No description

mixed post($field = false, mixed $defaultValue = null)

Get the whole $_POST array or a specific posted value.

Parameters

$field
mixed $defaultValue

what to return if $key is specified but it does not exist in the $_POST

Return Value

mixed

See also

AbstractController::post

redirect() deprecated

deprecated you should return a Response instance from your methods

Redirect the clients to a specific URL/page (specify path(s) as argument(s) of this function).

runTask(mixed $action, mixed $parameters) deprecated

deprecated use the runAction method

No description

Parameters

mixed $action
mixed $parameters

mixed runAction(string $action, array $parameters = [])

Perform an action of this controller (if shouldRunControllerTask returns true).

Parameters

string $action

the action to be performed

array $parameters

the action parameters

Return Value

mixed

in case the action is executed, you'll receive the result of the action, or NULL otherwise

mixed request($field = false)

Get the whole $_REQUEST array or a specific requested value.

Parameters

$field

Return Value

mixed

See also

AbstractController::request

__destruct()

No description

IconFormatterInterface getIconFormatter()

Return a formatter object that provides an icon that will be shown in the list of attributes.

Example implementation: return new FontAwesomeIconFormatter('check-square');

Return Value

IconFormatterInterface

setAttributeType($attributeType)

No description

Parameters

$attributeType

See also

AttributeInterface::setAttributeType

Type getAttributeType()

Returns a Type entity.

The Type object is mapped with a row from the AttributeTypes table. Use the object for example to retrieve the current attribute type handle (e.g. 'date_time').

string|null getAttributeTypeFileURL(string $_file)

No description

Parameters

string $_file

Return Value

string|null

ErrorList validateKey(array|false $data = false)

No description

Parameters

array|false $data

Return Value

ErrorList

string getAttributeKeySettingsClass()

No description

Return Value

string

mixed setAttributeKey($attributeKey)

No description

Parameters

$attributeKey

Return Value

mixed

See also

AttributeInterface::setAttributeKey

AttributeKeyInterface getAttributeKey()

Returns a Key entity.

A key is mapped with a row from the AttributeKeys table. Use the object for example to retrieve the current attribute handle (e.g. 'meta_title').

saveKey(array $data)

This method is called any time an attribute key is created or updated.

$data is simply the POST values from the form.

Parameters

array $data

duplicateKey(mixed $newAK)

No description

Parameters

mixed $newAK

deleteKey()

No description

Settings createAttributeKeySettings()

No description

Return Value

Settings

Settings getAttributeKeySettings()

No description

Return Value

Settings

string getAttributeValueClass()

Is used to determine the name of the entity used to store the attribute value.

You can reuse this throughout your controllers, but it's used by the getAttributeValueObject() method in the base controller to retrieve the relevant attribute data value object.

Return Value

string

setAttributeValue(AbstractValue|null $attributeValue)

No description

Parameters

AbstractValue|null $attributeValue

AttributeValueInterface getAttributeValue()

Get Attribute Value object.

AbstractValue|null getAttributeValueObject()

No description

Return Value

AbstractValue|null

AbstractValue|null createDefaultAttributeValue()

Create the default attribute value (if needed).

Return Value

AbstractValue|null

AttributeValueInterface createAttributeValueFromRequest()

Is run when an attribute is saved through the standard user interfaces like the sitemap attributes dialog, the attributes panel, or the user attributes slideouts.

AttributeValueInterface createAttributeValue($value)

Is run whenever $object->setAttribute('my_property_location_attribute', $value) is run through code, with whatever you happen to pass through.

Parameters

$value

Return Value

AttributeValueInterface

deleteValue()

No description

array|null getSearchIndexFieldDefinition()

No description

Return Value

array|null

string|int getSearchIndexValue()

This value will be used by the search index.

Return Value

string|int

See also

AttributeInterface::getSearchIndexValue

string|null searchKeywords(mixed $keywords, QueryBuilder $queryBuilder)

No description

Parameters

mixed $keywords
QueryBuilder $queryBuilder

Return Value

string|null

filterByAttribute(AttributedItemList $list, mixed $value, string $comparison = '=')

No description

Parameters

AttributedItemList $list
mixed $value
string $comparison

importKey(SimpleXMLElement $akey)

No description

Parameters

SimpleXMLElement $akey

mixed exportKey($akey)

No description

Parameters

$akey

Return Value

mixed

mixed importValue(SimpleXMLElement $akv)

No description

Parameters

SimpleXMLElement $akv

Return Value

mixed

SimpleXMLElement exportValue(SimpleXMLElement $akv)

No description

Parameters

SimpleXMLElement $akv

Return Value

SimpleXMLElement

mixed getDisplayValue()

For a DateTime implementation this could for example mean that the value is formatted and localized.

Return Value

mixed

FormViewInterface getControlView(ContextInterface $context)

No description

Parameters

ContextInterface $context

Return Value

FormViewInterface

View getView()

No description

Return Value

View

string field(string $fieldName)

No description

Parameters

string $fieldName

Return Value

string

string getControlID()

Get the ID to use for label elements. Not applicable in form views that do not contain

Return Value

string

string getLabelID() deprecated

deprecated

Get the ID to use for label elements.

Return Value

string

label(string|bool $customText = false) deprecated

deprecated . This should be handled by the templates including

No description

Parameters

string|bool $customText

setRequestArray(array|false $array)

No description

Parameters

array|false $array

ValidatorInterface getValidator()

No description

Return Value

ValidatorInterface

bool requestFieldExists()

No description

Return Value

bool

setupAndRun(string $method)

No description

Parameters

string $method

saveForm(mixed $data) deprecated

deprecated

No description

Parameters

mixed $data

saveValue(mixed $mixed) deprecated

deprecated

No description

Parameters

mixed $mixed

getAttributeValueID() deprecated

deprecated

No description

protected Settings|null retrieveAttributeKeySettings()

No description

Return Value

Settings|null

form()

No description

searchForm($list)

No description

Parameters

$list

No description

validateValue()

No description

validateForm($data)

No description

Parameters

$data

string getAttributeValueTextRepresentation()

Get a string containing the text representation of the attribute value currently set in the controller.

AbstractValue|null updateAttributeValueFromTextRepresentation(string $textRepresentation, ErrorList $warnings)

Update or create the attribute value starting from its text representation.

Parameters

string $textRepresentation

the text representation of the attribute value

ErrorList $warnings

An ErrorList instance that the method can add decoding warnings to

Return Value

AbstractValue|null

Returns NULL if the controller doesn't have already a value and $textRepresentation is empty

See also

SimpleTextExportableAttributeInterface::updateAttributeValueFromTextRepresentation

getValue()

No description

composer()

No description

type_form()

No description

protected load()

No description