Controller
class Controller extends Controller implements SimpleTextExportableAttributeInterface, OpenApiSpecifiableInterface, SupportsAttributeValueFromJsonInterface, SimpleApiAttributeValueInterface (View source)
Traits
Trait ApplicationAwareTrait A trait used with ApplicationAwareInterface
Properties
protected Application | $app | from ApplicationAwareTrait | |
protected string[] | $helpers | The handles of the helpers to be returned by the getHelperObjects method. |
from AbstractController |
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 | |
Type|null deprecated | $attributeType | from Controller | |
protected Key|null | $attributeKey | from Controller | |
protected AbstractValue | $attributeValue | from Controller | |
protected ObjectInterface | $attributeObject | from Controller | |
protected | $searchIndexFieldDefinition | ||
protected false|array | $requestArray | from Controller |
Methods
Adds an item to the view's header. This item will then be automatically printed out before the
section of the page.Adds an item to the view's footer. This item will then be automatically printed out before the section of the page.
Should the action be executed? Override this method to answer something different than true.
Get the the helpers that will be be automatically sent to Views as variables.
Get the whole $_GET array or a specific querystring value.
Override this method to do something right before the view is rendered.
Get the whole $_POST array or a specific posted value.
Redirect the clients to a specific URL/page (specify path(s) as argument(s) of this function).
Build a response that redirects clients to a specific URL/page (specify path(s) as argument(s) of $args).
Perform an action of this controller (if shouldRunControllerTask returns true).
Get the whole $_REQUEST array or a specific requested value.
Return a formatter object that provides an icon that will be shown in the list of attributes.
This method is called any time an attribute key is created or updated.
Is used to determine the name of the entity used to store the attribute value.
Create the default attribute value (if needed).
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.
Is run whenever $object->setAttribute('my_property_location_attribute', $value) is run through code, with whatever you happen to pass through.
No description
For a DateTime implementation this could for example mean that the value is formatted and localized.
Get the ID to use for label elements. Not applicable in form views that do not contain
No description
No description
No description
No description
No description
Get a string containing the text representation of the attribute value currently set in the controller.
Update or create the attribute value starting from its text representation.
Could be a string, could be an array representation of a more complex request body object
No description
Details
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.
This function accept the same parameters as the requireAsset method of the ResponseAssetGroup.
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.
Array keys are the variable names, array values are the helper instances.
mixed
get(string|null $key = null, mixed $defaultValue = null)
Get the whole $_GET array or a specific querystring value.
getTask()
deprecated
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.
For instance, you can call $this->set('variableName', $variableValue) to send the view additional sets.
isPost()
deprecated
deprecated
No description
mixed
post($field = false, mixed $defaultValue = null)
Get the whole $_POST array or a specific posted value.
redirect()
deprecated
deprecated
Redirect the clients to a specific URL/page (specify path(s) as argument(s) of this function).
RedirectResponse
buildRedirect(array|string|UrlInterface $destination, int $httpResponseCode = Response::HTTP_FOUND)
Build a response that redirects clients to a specific URL/page (specify path(s) as argument(s) of $args).
runTask(mixed $action, mixed $parameters)
deprecated
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.
executeCommand(mixed $command)
Dispatches a command to the command bus.
dispatchBatch(Batch $batch)
No description
__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');
setAttributeType($attributeType)
No description
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').
setAttributeObject(ObjectInterface $object)
Set the subject for which the value is being managed.
string|null
getAttributeTypeFileURL(string $_file)
No description
ErrorList
validateKey(array|false $data = false)
No description
string
getAttributeKeySettingsClass()
No description
mixed
setAttributeKey($attributeKey)
No description
AttributeKeyInterface|Key
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').
Type|null|void
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.
duplicateKey(mixed $newAK)
No description
deleteKey()
No description
Settings
createAttributeKeySettings()
No description
Settings
getAttributeKeySettings()
No description
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.
setAttributeValue(AbstractValue|null $attributeValue)
No description
AttributeValueInterface
getAttributeValue()
Get Attribute Value object.
AbstractValue|null
getAttributeValueObject()
No description
AbstractValue|null
createDefaultAttributeValue()
Create the default attribute value (if needed).
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.
deleteValue()
No description
array|null
getSearchIndexFieldDefinition()
No description
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
Settings|null
importKey(SimpleXMLElement $element)
No description
mixed
exportKey(mixed $ak)
No description
mixed
importValue(SimpleXMLElement $akv)
No description
SimpleXMLElement
exportValue(SimpleXMLElement $akv)
No description
mixed
getDisplayValue()
For a DateTime implementation this could for example mean that the value is formatted and localized.
FormViewInterface
getControlView(ContextInterface $context)
No description
View
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
deprecated
Get the ID to use for label elements.
label(string|bool $customText = false)
deprecated
deprecated
No description
setRequestArray(array|false $array)
No description
ValidatorInterface
getValidator()
No description
bool
requestFieldExists()
No description
setupAndRun(string $method)
No description
saveForm(mixed $data)
deprecated
deprecated
No description
saveValue(mixed $mixed)
deprecated
deprecated
No description
getAttributeValueID()
deprecated
deprecated
No description
protected Settings|null
retrieveAttributeKeySettings()
No description
searchForm($list)
No description
search()
No description
form()
No description
validateForm($p)
No description
validateValue()
No description
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.
SpecProperty
getOpenApiSpecProperty(Key $key)
No description
mixed
createAttributeValueFromNormalizedJson(mixed $json)
Could be a string, could be an array representation of a more complex request body object
mixed
getApiAttributeValue()
No description