PHP Class Sulu\Component\Rest\RestController

Inheritance: extends FOS\RestBundle\Controller\FOSRestController
Afficher le fichier Open project: sulu/sulu

Protected Properties

Свойство 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.

Méthodes publiques

Méthode 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

Méthodes protégées

Méthode 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 méthode

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
Résultat array

createHalResponse() protected méthode

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

findMatch() protected méthode

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 méthode

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

processPut() protected méthode

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
Résultat boolean

replaceOrAddUrlString() public méthode

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
Résultat mixed | string

responseDelete() public méthode

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
Résultat FOS\RestBundle\View\View

responseFields() public méthode

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

responseGetById() protected méthode

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
Résultat FOS\RestBundle\View\View

responseList() protected méthode

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
Résultat Symfony\Component\HttpFoundation\Response

responsePersistSettings() public méthode

public responsePersistSettings ( ) : Response
Résultat Symfony\Component\HttpFoundation\Response

Property Details

$bundlePrefix protected_oe property

standard bundle prefix.
protected string $bundlePrefix
Résultat 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
Résultat string

$entityName protected_oe static_oe property

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

$fieldTypes protected_oe property

contains the matching between fields and their types.
protected array $fieldTypes
Résultat array

$fieldsDefault protected_oe property

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

$fieldsEditable protected_oe property

contains fields that are editable.
protected array $fieldsEditable
Résultat array

$fieldsExcluded protected_oe property

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

$fieldsHidden protected_oe property

contains all fields that should be hidden by default from api.
protected array $fieldsHidden
Résultat 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
Résultat array

$fieldsSortOrder protected_oe property

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

$fieldsTranslationKeys protected_oe property

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

$fieldsValidation protected_oe property

contains arrays of validation key-value data.
protected array $fieldsValidation
Résultat 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
Résultat array

$unsortable protected_oe property

contains all attributes that are not sortable.
protected array $unsortable
Résultat array