Xima\XmTools\Classes\API\REST\Repository\ApiRepository

class ApiRepository

Abstract class for extbase repositories to retrieve data through a REST API. The name of the inheriting repository class will be used for creating the API URL and instantiating model classes. This behaviour can be changed by overriding the function getApiTarget().

property extensionManager

protected XimaXmToolsClassesTypo3ExtensionExtensionManager

property connector

protected XimaXmToolsClassesAPIRESTConnector

The connector class.

property typo3Services

protected XimaXmToolsClassesTypo3Services

The xm_tools facade.

property apiKey

protected

property apiUrl

protected

property apiSchema

protected

property apiRouteFindById

protected

property apiRouteFindByQuery

protected

property apiRouteCreate

protected

property apiRouteUpdate

protected

property lastReponse

protected

initializeObject()

Retrieves the calling extension through the package name of the inheriting repository class. Configures the repository with the extensions’ settings.

findByUid($id)

Find an entity by id.

Parameters:
  • $id
Returns:

XimaXmToolsClassesAPIRESTModelAbstractEntity|array The model class or array with the given id.

findAll()

findAll.

Returns:Array of model objects according the repository class name, if existing, otherwise array of arrays. Indexed by id.
findAllByQuery(XimaXmToolsClassesTypo3QueryQueryInterface $query)

Find all entities filtered by a XimaXmToolsClassesTypo3QueryQueryInterface.

Parameters:
  • $query (XimaXmToolsClassesTypo3QueryQueryInterface) – The filter object.
Returns:

Array of model objects

createQuery()

Create a XimaXmToolsClassesAPIRESTQuery object. Overrides TYPO3 default behavivour.

Returns:XimaXmToolsClassesAPIRESTQuery
buildUrl($route, $params = array())

Builds the URL to API. The API schema must be definedin the TYPO3 constant editor to something like: -[Api-URL]/[Api-Key][Api-Route] -[Api-URL][Api-Route]?[Api-Key] -...

Parameters:
  • $route
  • $params
Returns:

string

getApiTarget()
persist(XimaXmToolsClassesAPIRESTModelAbstractEntity $entity)
Parameters:
  • $entity (XimaXmToolsClassesAPIRESTModelAbstractEntity) –
getApiKey()
setApiKey($apiKey)
Parameters:
  • $apiKey
getApiUrl()
setApiUrl($apiUrl)
Parameters:
  • $apiUrl
getApiSchema()
setApiSchema($apiSchema)
Parameters:
  • $apiSchema
getApiRouteFindById()
setApiRouteFindById($apiRouteFindById)
Parameters:
  • $apiRouteFindById
getApiRouteFindByQuery()
setApiRouteFindByQuery($apiRouteFindByQuery)
Parameters:
  • $apiRouteFindByQuery
getObjectType()

To make it compatible with Typo3.

getLastReponse()
setLastReponse($lastReponse)
Parameters:
  • $lastReponse
getApiRouteCreate()
setApiRouteCreate($apiRouteCreate)
Parameters:
  • $apiRouteCreate
getApiRouteUpdate()
setApiRouteUpdate($apiRouteUpdate)
Parameters:
  • $apiRouteUpdate
findBy($criteria, $orderBy = null, $limit = null, $offset = null)

Finds entities by a set of criteria.

Parameters:
  • $criteria
  • $orderBy (array|null) –
  • $limit
  • $offset
Returns:

array The objects.