PHP Class Sulu\Component\Rest\RestController

Inheritance: extends FOS\RestBundle\Controller\FOSRestController
Datei anzeigen Open project: sulu/sulu

Protected Properties

Property Type Description
$bundlePrefix string standard bundle prefix.
$entityKey string The key of the entity which will be used in the embedded part of the REST Response.
$entityName string The type of the entity, which is handled by the concrete controller.
$fieldTypes array contains the matching between fields and their types.
$fieldsDefault array contains fields that cannot be hidden and are visible by default.
$fieldsEditable array contains fields that are editable.
$fieldsExcluded array contains all fields that should be excluded from api.
$fieldsHidden array contains all fields that should be hidden by default from api.
$fieldsMinWidth contains the widths of the fields
$fieldsRelations array contains all field relations.
$fieldsSortOrder array contains sort order of elements: array(order => fieldName).
$fieldsTranslationKeys array contains custom translation keys like array(fieldName => translationKey).
$fieldsValidation array contains arrays of validation key-value data.
$fieldsWidth contains the widths of the fields
$sortable array contains all attributes that are sortable if defined unsortable gets ignored.
$unsortable array contains all attributes that are not sortable.

Public Methods

Method Description
getLocale ( Request $request ) : mixed Returns the language.
replaceOrAddUrlString ( string $url, string $key, string $value, boolean $add = true ) : mixed | string function replaces a url parameter.
responseDelete ( $id, $deleteCallback ) : FOS\RestBundle\View\View Deletes the entity with the given id using the deleteCallback and return a successful response, or an error message with a 4xx status code.
responseFields ( ) : Response Creates a response which contains all fields of the current entity.
responsePersistSettings ( ) : Response

Protected Methods

Method Description
addFieldAttributes ( $fields, $fieldsHidden = [] ) : array creates the translation keys array and sets the default attribute, if set also adds the type property for.
createHalResponse ( array $entities, boolean $returnListLinks = false ) : array creates HAL conform response-array out of an entity collection.
findMatch ( array $requestEntities, integer $id, array &$matchedEntry, string &$matchedKey ) Tries to find a given id in a given set of entities. Returns the entity itself and its key with the $matchedEntry and $matchKey parameters.
getHalLinks ( array $entities, integer $pages = 1, boolean $returnListLinks = false ) : array returns HAL-conform _links array.
processPut ( ApiEntity[] $entities, $requestEntities, callback $deleteCallback, callback $updateCallback, callback $addCallback, callback $entityIdCallback = null ) : boolean This method processes a put request (delete non-existing entities, update existing entities, add new entries), and let the single actions be modified by callbacks.
responseGetById ( $id, callback $findCallback ) : FOS\RestBundle\View\View Returns the response with the entity with the given id, or a response with a status of 404, in case the entity is not found. The find method is injected by a callback.
responseList ( array $where = [], string $entityName = null, Function $entityFilter = null, array $joinConditions = [] ) : Response Lists all the entities or filters the entities by parameters Special function for lists route /contacts/list.

Method Details

addFieldAttributes() protected method

creates the translation keys array and sets the default attribute, if set also adds the type property for.
protected addFieldAttributes ( $fields, $fieldsHidden = [] ) : array
$fields
$fieldsHidden
return array

createHalResponse() protected method

creates HAL conform response-array out of an entity collection.
Deprecation:
protected createHalResponse ( array $entities, boolean $returnListLinks = false ) : array
$entities array
$returnListLinks boolean
return array

findMatch() protected method

Tries to find a given id in a given set of entities. Returns the entity itself and its key with the $matchedEntry and $matchKey parameters.
protected findMatch ( array $requestEntities, integer $id, array &$matchedEntry, string &$matchedKey )
$requestEntities array The set of entities to search in
$id integer The id to search
$matchedEntry array
$matchedKey string

getLocale() public method

Returns the language.
public getLocale ( Request $request ) : mixed
$request Symfony\Component\HttpFoundation\Request
return mixed

processPut() protected method

This method processes a put request (delete non-existing entities, update existing entities, add new entries), and let the single actions be modified by callbacks.
Deprecation:
protected processPut ( ApiEntity[] $entities, $requestEntities, callback $deleteCallback, callback $updateCallback, callback $addCallback, callback $entityIdCallback = null ) : boolean
$entities Sulu\Bundle\CoreBundle\Entity\ApiEntity[]
$requestEntities
$deleteCallback callback
$updateCallback callback
$addCallback callback
$entityIdCallback callback defines how to get the entity's id which will be compared with requestEntities' id
return boolean

replaceOrAddUrlString() public method

function replaces a url parameter.
Deprecation:
public replaceOrAddUrlString ( string $url, string $key, string $value, boolean $add = true ) : mixed | string
$url string String the complete url
$key string String parameter name (e.g. page=)
$value string replace value
$add boolean defines if value should be added
return mixed | string

responseDelete() public method

Deletes the entity with the given id using the deleteCallback and return a successful response, or an error message with a 4xx status code.
public responseDelete ( $id, $deleteCallback ) : FOS\RestBundle\View\View
$id
$deleteCallback
return FOS\RestBundle\View\View

responseFields() public method

Creates a response which contains all fields of the current entity.
Deprecation:
public responseFields ( ) : Response
return Symfony\Component\HttpFoundation\Response

responseGetById() protected method

Returns the response with the entity with the given id, or a response with a status of 404, in case the entity is not found. The find method is injected by a callback.
protected responseGetById ( $id, callback $findCallback ) : FOS\RestBundle\View\View
$id
$findCallback callback
return FOS\RestBundle\View\View

responseList() protected method

Lists all the entities or filters the entities by parameters Special function for lists route /contacts/list.
Deprecation:
protected responseList ( array $where = [], string $entityName = null, Function $entityFilter = null, array $joinConditions = [] ) : Response
$where array
$entityName string
$entityFilter Function function for filtering entities
$joinConditions array to specify join conditions
return Symfony\Component\HttpFoundation\Response

responsePersistSettings() public method

public responsePersistSettings ( ) : Response
return Symfony\Component\HttpFoundation\Response

Property Details

$bundlePrefix protected_oe property

standard bundle prefix.
protected string $bundlePrefix
return string

$entityKey protected_oe static_oe property

The key of the entity which will be used in the embedded part of the REST Response.
protected static string $entityKey
return string

$entityName protected_oe static_oe property

The type of the entity, which is handled by the concrete controller.
protected static string $entityName
return string

$fieldTypes protected_oe property

contains the matching between fields and their types.
protected array $fieldTypes
return array

$fieldsDefault protected_oe property

contains fields that cannot be hidden and are visible by default.
protected array $fieldsDefault
return array

$fieldsEditable protected_oe property

contains fields that are editable.
protected array $fieldsEditable
return array

$fieldsExcluded protected_oe property

contains all fields that should be excluded from api.
Deprecation:
protected array $fieldsExcluded
return array

$fieldsHidden protected_oe property

contains all fields that should be hidden by default from api.
protected array $fieldsHidden
return array

$fieldsMinWidth protected_oe property

contains the widths of the fields
protected $fieldsMinWidth

$fieldsRelations protected_oe property

contains all field relations.
Deprecation:
protected array $fieldsRelations
return array

$fieldsSortOrder protected_oe property

contains sort order of elements: array(order => fieldName).
protected array $fieldsSortOrder
return array

$fieldsTranslationKeys protected_oe property

contains custom translation keys like array(fieldName => translationKey).
Deprecation:
protected array $fieldsTranslationKeys
return array

$fieldsValidation protected_oe property

contains arrays of validation key-value data.
protected array $fieldsValidation
return array

$fieldsWidth protected_oe property

contains the widths of the fields
Deprecation:
protected $fieldsWidth

$sortable protected_oe property

contains all attributes that are sortable if defined unsortable gets ignored.
protected array $sortable
return array

$unsortable protected_oe property

contains all attributes that are not sortable.
protected array $unsortable
return array