OscRecalculateController
extends SetUserController
in package
Uses
SetPaymentSystemTrait, SetDeliveryTrait, DeleteRowTrait, AddVoucherTrait, DeleteVoucherTrait, RecalculateBasketTrait, RedeemRewardPointsTrait
This is the OSC internal recalculate controller.
This class extends BaseJsonController, see this class.
Tags
Table of Contents
ARRAY_FIELDS | This constant is an array that defines the fields of type ARRAY. | = [\FWK\Enums\Parameters::CUSTOM_TAGS] |
---|---|---|
BILLING | = 'billing' | |
BILLING_FIELDS | This constant is an array that defines the fields to consider for a billing address. | = [\FWK\Enums\Parameters::ALIAS, \FWK\Enums\Parameters::ADDRESS_ID, \FWK\Enums\Parameters::USER_TYPE, \FWK\Enums\Parameters::DEFAULT_ADDRESS, \FWK\Enums\Parameters::FIRST_NAME, \FWK\Enums\Parameters::LAST_NAME, \FWK\Enums\Parameters::COMPANY, \FWK\Enums\Parameters::ADDRESS, \FWK\Enums\Parameters::ADDRESS_ADDITIONAL_INFORMATION, \FWK\Enums\Parameters::NUMBER, \FWK\Enums\Parameters::CITY, \FWK\Enums\Parameters::STATE, \FWK\Enums\Parameters::POSTAL_CODE, \FWK\Enums\Parameters::VAT, \FWK\Enums\Parameters::NIF, \FWK\Enums\Parameters::PHONE, \FWK\Enums\Parameters::MOBILE, \FWK\Enums\Parameters::FAX, \FWK\Enums\Parameters::LOCATION_LIST, \FWK\Enums\Parameters::COUNTRY] |
BOOL_FIELDS | This constant is an array that defines the fields of type BOOL. | = [\FWK\Enums\Parameters::USE_SHIPPING_ADDRESS, \FWK\Enums\Parameters::SUBSCRIBED, \FWK\Enums\Parameters::CREATE_ACCOUNT] |
CONTROLLER_ITEM | This is the name of the main controller item, for example, if your request is over a productController, the itemController has the product that referer the url. | = 'controllerItem' |
CREATE_ACCOUNT_FIELDS | This constant is an array that defines the fields to consider when creating a user. | = [\FWK\Enums\Parameters::EMAIL, \FWK\Enums\Parameters::PASSWORD, \FWK\Enums\Parameters::GODFATHER_CODE, \FWK\Enums\Parameters::CREATE_ACCOUNT, \FWK\Enums\Parameters::CUSTOM_TAGS, \FWK\Enums\Parameters::P_ID, \FWK\Enums\Parameters::NICK, \FWK\Enums\Parameters::GENDER, \FWK\Enums\Parameters::BIRTHDAY, \FWK\Enums\Parameters::USE_SHIPPING_ADDRESS, \FWK\Enums\Parameters::SUBSCRIBED, \FWK\Enums\Parameters::IMAGE] |
CUSTOM_TAGS | = 'customTags' | |
DATA | = 'data' | |
DATE_FIELDS | This constant is an array that defines the fields of type DATE. | = [\FWK\Enums\Parameters::BIRTHDAY] |
SHIPPING | = 'shipping' | |
SHIPPING_FIELDS | This constant is an array that defines the fields to consider for a shipping address. | = self::BILLING_FIELDS |
SUBSCRIBED | = 'subscribed' | |
UPDATE_ACCOUNT_FIELDS | This constant is an array that defines the fields to consider when updating a user. | = [\FWK\Enums\Parameters::P_ID, \FWK\Enums\Parameters::NICK, \FWK\Enums\Parameters::GENDER, \FWK\Enums\Parameters::BIRTHDAY, \FWK\Enums\Parameters::USE_SHIPPING_ADDRESS, \FWK\Enums\Parameters::SUBSCRIBED, \FWK\Enums\Parameters::IMAGE] |
USER | = 'user' | |
CODE | = 'code' | |
MESSAGE | = 'message' | |
REQUEST_ID | = 'requestId' | |
RESPONSE | = 'response' | |
STATUS | = 'status' | |
SUCCESS | = 'success' | |
$appliedParameters | : array<string|int, mixed> | |
$availableParams | : array<string|int, mixed> | |
$billingAddressParametersGroup | : BillingAddressParametersGroup|null | |
$commerceCalendar | : IntlCalendar|null | |
$commerceDateTime | : DateTime|null | |
$language | $route will contains the language retuned from the API in route['language']<br> Default value 'en' | : Language |
$loggedInRequired | This attribute define if the controller required a logged in session | : bool |
$requestParams | This attribute contains the parameters of the request (GET or POST parameters) | : array<string|int, mixed> |
$responseMessage | : string | |
$responseMessageError | : string | |
$salesAgentRequired | This attribute define if the controller required a sales Agent in session | : bool |
$shippingAddressParametersGroup | : ShippingAddressParametersGroup|null | |
$simulatedUserForbbiden | This attribute define if the controller simulated user | : bool |
$theme | : Theme|null | |
$twig | This attribute references the TwigLoader instance of the controller, this is the component of our MVC that is in charge of rendering the response. | : TwigLoaderInterface|null |
$userParametersGroup | : UserParametersGroup|null | |
$userService | : UserService|null | |
__construct() | Constructor. | : mixed |
getGlobalDataKeys() | This method returns the global data keys | : array<string|int, mixed> |
getInputFilterParameters() | This method returns an array of the input params indicating in each node the param name, and the filter to apply. | : array<string|int, mixed> |
getRequestParam() | Returns the value of a filtered request parameter. | : mixed|null |
getRequestParams() | Returns a array with de filtered parameters | : array<string|int, mixed> |
getUserGroupPId() | This method calculates the UserGroupId to apply to the user | : string |
parseData() | This method parses the request params | : array<string|int, mixed> |
run() | This method executes the controller following these steps: <ol> <li>Get required data</li> <li>Create TwigLoader</li> <li>Render Twig template</li> <li>Output Twig response</li> </ol> | : void |
addResponseHeaders() | This method sets the the response header when execute self::run(). | : void |
addTwigBaseExtensions() | This method is the one in charge of defining base extensions that are needed for the Twig template and adding them to the TwigLoader given by parameter. | : void |
addTwigBaseFunctions() | This method is the one in charge of defining base functions that are needed for the Twig template and adding them to the TwigLoader given by parameter. | : void |
breakControllerProcess() | This method breaks the execution of the controller throwing a CommerceException with the message and code given by parameters. | : void |
checkCriticalServiceLoaded() | This method checks if the data required for the correct run of the controller has a correct value, in opposite, it breaks the execution of the controller | : void |
deleteControllerData() | This method delete the value from controller data by key value, if the key doesn't exist it returns false | : bool |
fillParametersGroup() | : void | |
forbiddenSimulatedUser() | This method validate if the session is a simulated user | : void |
getAddVoucherResponseData() | Returns the response data for the set vouchers actions. | : Element|null |
getControllerData() | This method returns the value from controller data by key value, if the key doesn't exist it returns null | : mixed|null |
getDeleteRowResponseData() | Returns the response data for the delete basket row actions. | : Element|null |
getDeleteVoucherResponseData() | Returns the response data for the set deliveries actions. | : Element|null |
getDeliveryResponseData() | Returns the response data for the set deliveries actions. | : Element|null |
getFilterParams() | {@inheritdoc} | : array<string|int, mixed> |
getLanguageSheet() | This method returns the language sheet of the controller's language | : array<string|int, mixed> |
getOriginParams() | {@inheritdoc} | : mixed |
getParsedParamsData() | : array<string|int, mixed> | |
getPaymentSystemResponseData() | Returns the response data for the set payment systems actions. | : Element|null |
getRecalculateBasketResponseData() | Returns the response data for the set deliveries actions. | : Element|null |
getRedeemRewardPointsResponseData() | Returns the response data for the redeem reward points actions. | : Element|null |
getResponse() | This method returns an array containing the response information. | : array<string|int, mixed> |
getResponseData() | This method launches the user action against the SDK (through the FWK services) and returns the data of the response (the user data). | : Element |
getResponseError() | This method returns an array containing the response error information. | : array<string|int, mixed> |
getRoute() | This method returns the route of this controller | : Route |
getSeoItems() | This method returns the metatags value | : SeoItems|null |
getSession() | This method returns the session value, if the request is cacheable returns null | : Session|null |
getStatus() | This method returns an array containing the status information, based on the given parameters. | : array<string|int, mixed> |
getTheme() | : Theme | |
getTypeForm() | This method returns the type of the form. | : string |
getUrlRedirect() | This method returns the url to redirect. | : string |
initializeAppliedParameters() | {@inheritDoc} | : void |
isForbidden() | This method returns if the request should be run as a forbidden request. | : bool |
parseResponseData() | This method parses the given user element and returns it parsed. | : Element |
preSendControllerBaseBatchData() | This method runs previously to run ControllerBaseBatchData | : void |
preSetControllerBaseData() | This method runs previously to run setControllerBaseData | : void |
render() | This method executes the renderization of the page and returns this renderization. | : string |
response() | This method generates the request response | : void |
setBatchData() | {@inheritdoc} | : void |
setControllerBaseBatchData() | {@inheritdoc} | : void |
setControllerBaseData() | This method is in charge of defining the basic data necessary for the correct operation of the controller. | : void |
setData() | This method runs after the batch requests (defined in the setBatchData methods) are resolved, so here you can work with the response of the batch requests and calculate and set more needed data. | : void |
setDataValue() | This method sets a key->value into de controller data. | : void |
setTwig() | This method builds the Twig object that will render the request. | : TwigLoader |
setType() | This method sets the response type when execute self::run() | : void |
userExists() | : bool | |
validateLoggedIn() | This method validate if the session is logged in | : void |
validateSalesAgent() | This method validate if the session is sales agent | : void |
Constants
ARRAY_FIELDS
This constant is an array that defines the fields of type ARRAY.
public
mixed
ARRAY_FIELDS
= [\FWK\Enums\Parameters::CUSTOM_TAGS]
BILLING
public
mixed
BILLING
= 'billing'
BILLING_FIELDS
This constant is an array that defines the fields to consider for a billing address.
public
mixed
BILLING_FIELDS
= [\FWK\Enums\Parameters::ALIAS, \FWK\Enums\Parameters::ADDRESS_ID, \FWK\Enums\Parameters::USER_TYPE, \FWK\Enums\Parameters::DEFAULT_ADDRESS, \FWK\Enums\Parameters::FIRST_NAME, \FWK\Enums\Parameters::LAST_NAME, \FWK\Enums\Parameters::COMPANY, \FWK\Enums\Parameters::ADDRESS, \FWK\Enums\Parameters::ADDRESS_ADDITIONAL_INFORMATION, \FWK\Enums\Parameters::NUMBER, \FWK\Enums\Parameters::CITY, \FWK\Enums\Parameters::STATE, \FWK\Enums\Parameters::POSTAL_CODE, \FWK\Enums\Parameters::VAT, \FWK\Enums\Parameters::NIF, \FWK\Enums\Parameters::PHONE, \FWK\Enums\Parameters::MOBILE, \FWK\Enums\Parameters::FAX, \FWK\Enums\Parameters::LOCATION_LIST, \FWK\Enums\Parameters::COUNTRY]
BOOL_FIELDS
This constant is an array that defines the fields of type BOOL.
public
mixed
BOOL_FIELDS
= [\FWK\Enums\Parameters::USE_SHIPPING_ADDRESS, \FWK\Enums\Parameters::SUBSCRIBED, \FWK\Enums\Parameters::CREATE_ACCOUNT]
CONTROLLER_ITEM
This is the name of the main controller item, for example, if your request is over a productController, the itemController has the product that referer the url.
public
mixed
CONTROLLER_ITEM
= 'controllerItem'
CREATE_ACCOUNT_FIELDS
This constant is an array that defines the fields to consider when creating a user.
public
mixed
CREATE_ACCOUNT_FIELDS
= [\FWK\Enums\Parameters::EMAIL, \FWK\Enums\Parameters::PASSWORD, \FWK\Enums\Parameters::GODFATHER_CODE, \FWK\Enums\Parameters::CREATE_ACCOUNT, \FWK\Enums\Parameters::CUSTOM_TAGS, \FWK\Enums\Parameters::P_ID, \FWK\Enums\Parameters::NICK, \FWK\Enums\Parameters::GENDER, \FWK\Enums\Parameters::BIRTHDAY, \FWK\Enums\Parameters::USE_SHIPPING_ADDRESS, \FWK\Enums\Parameters::SUBSCRIBED, \FWK\Enums\Parameters::IMAGE]
CUSTOM_TAGS
public
mixed
CUSTOM_TAGS
= 'customTags'
DATA
public
mixed
DATA
= 'data'
DATE_FIELDS
This constant is an array that defines the fields of type DATE.
public
mixed
DATE_FIELDS
= [\FWK\Enums\Parameters::BIRTHDAY]
SHIPPING
public
mixed
SHIPPING
= 'shipping'
SHIPPING_FIELDS
This constant is an array that defines the fields to consider for a shipping address.
public
mixed
SHIPPING_FIELDS
= self::BILLING_FIELDS
SUBSCRIBED
public
mixed
SUBSCRIBED
= 'subscribed'
UPDATE_ACCOUNT_FIELDS
This constant is an array that defines the fields to consider when updating a user.
public
mixed
UPDATE_ACCOUNT_FIELDS
= [\FWK\Enums\Parameters::P_ID, \FWK\Enums\Parameters::NICK, \FWK\Enums\Parameters::GENDER, \FWK\Enums\Parameters::BIRTHDAY, \FWK\Enums\Parameters::USE_SHIPPING_ADDRESS, \FWK\Enums\Parameters::SUBSCRIBED, \FWK\Enums\Parameters::IMAGE]
USER
public
mixed
USER
= 'user'
CODE
protected
mixed
CODE
= 'code'
MESSAGE
protected
mixed
MESSAGE
= 'message'
REQUEST_ID
protected
mixed
REQUEST_ID
= 'requestId'
RESPONSE
protected
mixed
RESPONSE
= 'response'
STATUS
protected
mixed
STATUS
= 'status'
SUCCESS
protected
mixed
SUCCESS
= 'success'
Properties
$appliedParameters
protected
array<string|int, mixed>
$appliedParameters
= []
$availableParams
protected
array<string|int, mixed>
$availableParams
= []
$billingAddressParametersGroup
protected
BillingAddressParametersGroup|null
$billingAddressParametersGroup
= null
$commerceCalendar
protected
IntlCalendar|null
$commerceCalendar
= null
$commerceDateTime
protected
DateTime|null
$commerceDateTime
= null
$language
$route will contains the language retuned from the API in route['language']<br> Default value 'en'
protected
Language
$language
$loggedInRequired
This attribute define if the controller required a logged in session
protected
bool
$loggedInRequired
= false
$requestParams
This attribute contains the parameters of the request (GET or POST parameters)
protected
array<string|int, mixed>
$requestParams
= []
$responseMessage
protected
string
$responseMessage
= 'Ok'
$responseMessageError
protected
string
$responseMessageError
= 'Error'
$salesAgentRequired
This attribute define if the controller required a sales Agent in session
protected
bool
$salesAgentRequired
= false
$shippingAddressParametersGroup
protected
ShippingAddressParametersGroup|null
$shippingAddressParametersGroup
= null
$simulatedUserForbbiden
This attribute define if the controller simulated user
protected
bool
$simulatedUserForbbiden
= false
$theme
protected
static Theme|null
$theme
= null
$twig
This attribute references the TwigLoader instance of the controller, this is the component of our MVC that is in charge of rendering the response.
protected
TwigLoaderInterface|null
$twig
= null
$userParametersGroup
protected
UserParametersGroup|null
$userParametersGroup
= null
$userService
protected
UserService|null
$userService
= null
Methods
__construct()
Constructor.
public
__construct(Route $route) : mixed
Parameters
- $route : Route
Return values
mixed —getGlobalDataKeys()
This method returns the global data keys
public
final static getGlobalDataKeys() : array<string|int, mixed>
Return values
array<string|int, mixed> —getInputFilterParameters()
This method returns an array of the input params indicating in each node the param name, and the filter to apply.
public
static getInputFilterParameters(string|null $typeForm[, bool $isUserAddress = false ][, User|null $user = null ]) : array<string|int, mixed>
Parameters
- $typeForm : string|null
- $isUserAddress : bool = false
- $user : User|null = null
Return values
array<string|int, mixed> —getRequestParam()
Returns the value of a filtered request parameter.
public
getRequestParam(string $parameter[, bool $required = false ][, mixed $default = null ]) : mixed|null
Parameters
- $parameter : string
- $required : bool = false
-
Sets if the request paramenter is required.
- $default : mixed = null
Tags
Return values
mixed|null —getRequestParams()
Returns a array with de filtered parameters
public
getRequestParams() : array<string|int, mixed>
Return values
array<string|int, mixed> —getUserGroupPId()
This method calculates the UserGroupId to apply to the user
public
getUserGroupPId(bool $newUser) : string
Parameters
- $newUser : bool
Return values
string —parseData()
This method parses the request params
public
static parseData(mixed $requestParams[, bool $simulaterUser = false ]) : array<string|int, mixed>
Parameters
- $requestParams : mixed
- $simulaterUser : bool = false
Return values
array<string|int, mixed> —run()
This method executes the controller following these steps: <ol> <li>Get required data</li> <li>Create TwigLoader</li> <li>Render Twig template</li> <li>Output Twig response</li> </ol>
public
run([array<string|int, mixed> $additionalData = [] ][, string $header = null ]) : void
Parameters
- $additionalData : array<string|int, mixed> = []
-
with the data to add to the controller data.
- $header : string = null
-
to be added to the header of the request response (default null)
Return values
void —addResponseHeaders()
This method sets the the response header when execute self::run().
protected
addResponseHeaders() : void
By default sets 'Access-Control-Allow-Origin:' to the host commerce
Tags
Return values
void —addTwigBaseExtensions()
This method is the one in charge of defining base extensions that are needed for the Twig template and adding them to the TwigLoader given by parameter.
protected
abstract addTwigBaseExtensions(TwigLoader $twig) : void
Parameters
- $twig : TwigLoader
Tags
Return values
void —addTwigBaseFunctions()
This method is the one in charge of defining base functions that are needed for the Twig template and adding them to the TwigLoader given by parameter.
protected
abstract addTwigBaseFunctions(TwigLoader $twig) : void
Parameters
- $twig : TwigLoader
Tags
Return values
void —breakControllerProcess()
This method breaks the execution of the controller throwing a CommerceException with the message and code given by parameters.
protected
breakControllerProcess(string $exceptionMessage[, int $exceptionCode = CommerceException::CONTROLLER_REDIRECT_ERROR ]) : void
Parameters
- $exceptionMessage : string
- $exceptionCode : int = CommerceException::CONTROLLER_REDIRECT_ERROR
Tags
Return values
void —checkCriticalServiceLoaded()
This method checks if the data required for the correct run of the controller has a correct value, in opposite, it breaks the execution of the controller
protected
checkCriticalServiceLoaded(object $data[, string $onExceptionCode = CommerceException::CONTROLLER_UNDEFINED_CRITICAL_DATA ]) : void
Parameters
- $data : object
-
is the data required for the correct run of the controller
- $onExceptionCode : string = CommerceException::CONTROLLER_UNDEFINED_CRITICAL_DATA
-
is the Exception to be thrown if the check is ko.
Return values
void —deleteControllerData()
This method delete the value from controller data by key value, if the key doesn't exist it returns false
protected
deleteControllerData(string $key) : bool
Parameters
- $key : string
Return values
bool —fillParametersGroup()
protected
fillParametersGroup(bool $newUser) : void
Parameters
- $newUser : bool
Return values
void —forbiddenSimulatedUser()
This method validate if the session is a simulated user
protected
abstract forbiddenSimulatedUser() : void
Tags
Return values
void —getAddVoucherResponseData()
Returns the response data for the set vouchers actions.
protected
getAddVoucherResponseData([string $code = '' ]) : Element|null
Parameters
- $code : string = ''
Return values
Element|null —getControllerData()
This method returns the value from controller data by key value, if the key doesn't exist it returns null
protected
getControllerData(string $key) : mixed|null
Parameters
- $key : string
Return values
mixed|null —getDeleteRowResponseData()
Returns the response data for the delete basket row actions.
protected
getDeleteRowResponseData([string $hash = '' ]) : Element|null
Parameters
- $hash : string = ''
Return values
Element|null —getDeleteVoucherResponseData()
Returns the response data for the set deliveries actions.
protected
getDeleteVoucherResponseData([string $code = '' ]) : Element|null
Parameters
- $code : string = ''
Return values
Element|null —getDeliveryResponseData()
Returns the response data for the set deliveries actions.
protected
getDeliveryResponseData([string $type = '' ][, string $deliveryHash = '' ][, array<string|int, mixed> $shipments = [] ]) : Element|null
Parameters
- $type : string = ''
- $deliveryHash : string = ''
- $shipments : array<string|int, mixed> = []
Return values
Element|null —getFilterParams()
{@inheritdoc}
protected
getFilterParams() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getLanguageSheet()
This method returns the language sheet of the controller's language
protected
getLanguageSheet() : array<string|int, mixed>
Return values
array<string|int, mixed> —getOriginParams()
{@inheritdoc}
protected
getOriginParams() : mixed
Tags
Return values
mixed —getParsedParamsData()
protected
getParsedParamsData() : array<string|int, mixed>
Return values
array<string|int, mixed> —getPaymentSystemResponseData()
Returns the response data for the set payment systems actions.
protected
getPaymentSystemResponseData([array<string|int, mixed> $payment = [] ]) : Element|null
Parameters
- $payment : array<string|int, mixed> = []
Return values
Element|null —getRecalculateBasketResponseData()
Returns the response data for the set deliveries actions.
protected
getRecalculateBasketResponseData([array<string|int, mixed> $data = [] ]) : Element|null
Parameters
- $data : array<string|int, mixed> = []
Return values
Element|null —getRedeemRewardPointsResponseData()
Returns the response data for the redeem reward points actions.
protected
getRedeemRewardPointsResponseData(int $id, int $value) : Element|null
Parameters
- $id : int
- $value : int
Return values
Element|null —getResponse()
This method returns an array containing the response information.
protected
getResponse() : array<string|int, mixed>
Format of the returned array:
- Position self::SUCCESS => contains 1
- Position self::MESSAGE => contains the message response
Return values
array<string|int, mixed> —getResponseData()
This method launches the user action against the SDK (through the FWK services) and returns the data of the response (the user data).
protected
getResponseData() : Element
Tags
Return values
Element —getResponseError()
This method returns an array containing the response error information.
protected
getResponseError() : array<string|int, mixed>
Format of the returned array:
- Position self::SUCCESS => contains 0
- Position self::MESSAGE => contains the error message response
Return values
array<string|int, mixed> —getRoute()
This method returns the route of this controller
protected
getRoute() : Route
Return values
Route —getSeoItems()
This method returns the metatags value
protected
getSeoItems() : SeoItems|null
Return values
SeoItems|null —getSession()
This method returns the session value, if the request is cacheable returns null
protected
getSession() : Session|null
Return values
Session|null —getStatus()
This method returns an array containing the status information, based on the given parameters.
protected
getStatus(int $code, string $message) : array<string|int, mixed>
Format of the returned array:
- Position self::CODE => contains the given code
- Position self::MESSAGE => contains the given message
Parameters
- $code : int
- $message : string
Return values
array<string|int, mixed> —getTheme()
protected
static getTheme() : Theme
Return values
Theme —getTypeForm()
This method returns the type of the form.
protected
getTypeForm() : string
Tags
Return values
string —Indicates the type of the form. See FormFactory constants for the types.
getUrlRedirect()
This method returns the url to redirect.
protected
getUrlRedirect() : string
Tags
Return values
string —initializeAppliedParameters()
{@inheritDoc}
protected
initializeAppliedParameters() : void
Tags
Return values
void —isForbidden()
This method returns if the request should be run as a forbidden request.
protected
isForbidden() : bool
Return values
bool —parseResponseData()
This method parses the given user element and returns it parsed.
protected
parseResponseData(Element $basket) : Element
Parameters
- $basket : Element
Tags
Return values
Element —preSendControllerBaseBatchData()
This method runs previously to run ControllerBaseBatchData
protected
preSendControllerBaseBatchData() : void
Return values
void —preSetControllerBaseData()
This method runs previously to run setControllerBaseData
protected
preSetControllerBaseData() : void
Return values
void —render()
This method executes the renderization of the page and returns this renderization.
protected
render([string $content = null ][, string $layout = null ][, string $version = null ][, string $format = 'html' ]) : string
Parameters
- $content : string = null
-
-> If different to null, it overrides the theme content to load in Twig
- $layout : string = null
-
-> If different to null, it overrides the theme layout to load in Twig
- $version : string = null
-
-> If different to null, it overrides the theme version to load in Twig
- $format : string = 'html'
-
-> Default value: 'html'. Set the format to mark the name of the layout. For example, with "json" value, Twig render going to load default.json.twig
Return values
string —containing the renderization of the page.
response()
This method generates the request response
protected
final response(string $output[, string $header = null ]) : void
Parameters
- $output : string
-
is the render of the page to be set to the response.
- $header : string = null
-
is a header to be added to the response.
Return values
void —setBatchData()
{@inheritdoc}
protected
setBatchData(BatchRequests $request) : void
Parameters
- $request : BatchRequests
Tags
Return values
void —setControllerBaseBatchData()
{@inheritdoc}
protected
final setControllerBaseBatchData(BatchRequests $requests) : void
Parameters
- $requests : BatchRequests
Tags
Return values
void —setControllerBaseData()
This method is in charge of defining the basic data necessary for the correct operation of the controller.
protected
abstract setControllerBaseData() : void
operation of the controller.
Tags
Return values
void —setData()
This method runs after the batch requests (defined in the setBatchData methods) are resolved, so here you can work with the response of the batch requests and calculate and set more needed data.
protected
abstract setData([array<string|int, mixed> $additionalData = [] ]) : void
Parameters
- $additionalData : array<string|int, mixed> = []
Tags
Return values
void —setDataValue()
This method sets a key->value into de controller data.
protected
setDataValue(string $key, mixed $value) : void
- If the key that you try to insert is a self::DATA_RESERVED_KEYS then it throws an exception with code CommerceException::CODE_CONTROLLER_SET_DATA_VALUE_RESERVED_KEY
- If the key already exists then it throws an exception with code CommerceException::CODE_CONTROLLER_SET_DATA_VALUE_ALREADY_DEFINED_KEY
Parameters
- $key : string
- $value : mixed
Tags
Return values
void —setTwig()
This method builds the Twig object that will render the request.
protected
setTwig([array<string|int, mixed> $data = [] ][, bool $loadCore = true ], int $autoescape[, string $themeName = null ]) : TwigLoader
Parameters
- $data : array<string|int, mixed> = []
-
-> This data will be merged with the controller.data
- $loadCore : bool = true
-
-> Set if is required to load the Twig Core Macros functionality
- $autoescape : int
-
-> @see \FWK\Enums\TwigAutoescape
- $themeName : string = null
-
-> Set the theme name overwriting the Theme->getInstance->getName()
Tags
Return values
TwigLoader —setType()
This method sets the response type when execute self::run()
protected
abstract setType() : void
Tags
Return values
void —userExists()
protected
userExists(string $value) : bool
Parameters
- $value : string
Return values
bool —validateLoggedIn()
This method validate if the session is logged in
protected
abstract validateLoggedIn() : void
Tags
Return values
void —validateSalesAgent()
This method validate if the session is sales agent
protected
abstract validateSalesAgent() : void