PHP Class ZF\Apigility\Admin\Model\RestServiceModel

Inheritance: implements Zend\EventManager\EventManagerAwareInterface
Afficher le fichier Open project: zfcampus/zf-apigility-admin Class Usage Examples

Protected Properties

Свойство Type Description
$configResource ZF\Configuration\ConfigResource
$events Zend\EventManager\EventManagerInterface
$module string
$moduleEntity ModuleEntity
$modulePath string
$modules ModulePathSpec
$renderer Zend\View\Renderer\PhpRenderer
$restArrayUpdateOptions array Allowed REST update options that are arrays
$restScalarUpdateOptions array Allowed REST update options that are scalars
$routeNameFilter Zend\Filter\FilterChain

Méthodes publiques

Méthode Description
__construct ( ModuleEntity $moduleEntity, ModulePathSpec $modules, ZF\Configuration\ConfigResource $config )
__get ( string $name ) : mixed Allow read-only access to properties
createCollectionClass ( string $serviceName ) : string Create a collection class for the resource
createContentNegotiationConfig ( RestServiceEntity $details, string $controllerService ) Create content negotiation configuration based on payload and discovered controller service name
createControllerServiceName ( string $serviceName ) : string Generate the controller service name from the module and service name
createEntityClass ( string $serviceName, string $template = 'entity', RestServiceEntity $details = null ) : string Create an entity class for the resource
createFactoryClass ( $serviceName )
createHalConfig ( RestServiceEntity $details, string $entityClass, string $collectionClass, string $routeName ) Create HAL configuration
createMediaType ( ) : string Create the mediatype for this
createResourceClass ( string $serviceName ) : string Creates a new resource class based on the specified service name
createRestConfig ( RestServiceEntity $details, string $controllerService, string $resourceClass, string $routeName ) Creates REST configuration
createRoute ( string $serviceName, string $route, string $routeIdentifier, string $controllerService ) : string Create the route configuration
createService ( RestServiceEntity $details ) : RestServiceEntity Create a new service using the details provided
deleteAuthorizationConfig ( RestServiceEntity $entity ) Delete any authorization configuration for a service
deleteContentNegotiationConfig ( RestServiceEntity $entity ) Delete content-negotiation configuration associated with a service
deleteContentValidationConfig ( RestServiceEntity $entity ) Delete content-validation configuration associated with a service
deleteHalConfig ( RestServiceEntity $entity ) Delete HAL configuration for the service
deleteRestConfig ( RestServiceEntity $entity ) Delete the REST configuration associated with the given service
deleteRoute ( RestServiceEntity $entity ) Delete the route associated with the given service
deleteService ( string $controllerService, boolean $recursive = false ) : true Delete a named service
deleteServiceManagerConfig ( RestServiceEntity $entity ) Delete any service manager configuration for the resource
deleteVersioningConfig ( RestServiceEntity $entity ) Delete versioning configuration for a service
fetch ( string $controllerService, boolean $isAFetchOperation = true ) : RestServiceEntity | false
fetchAll ( integer $version = null ) : RestServiceEntity[] Fetch all services
getEventManager ( ) : Zend\EventManager\EventManagerInterface Retrieve the EventManager instance
setEventManager ( Zend\EventManager\EventManagerInterface $events ) Set the EventManager instance
updateContentNegotiationConfig ( RestServiceEntity $original, RestServiceEntity $update ) Update the content negotiation configuration for the service
updateHalConfig ( RestServiceEntity $original, RestServiceEntity $update ) Update HAL configuration
updateRestConfig ( RestServiceEntity $original, RestServiceEntity $update ) Update REST configuration
updateRoute ( RestServiceEntity $original, RestServiceEntity $update ) Update the route for an existing service
updateService ( RestServiceEntity $update ) : RestServiceEntity Update an existing service

Méthodes protégées

Méthode Description
createClassFile ( Zend\View\Model\ViewModel $model, string $type, string $classPath ) : boolean Create a class file
deriveCollectionClass ( string $controllerServiceName, RestServiceEntity $metadata, array $config ) : string Derive the name of the collection class from the controller service name
deriveEntityClass ( string $controllerServiceName, RestServiceEntity $metadata, array $config ) : string Derive the name of the entity class from the controller service name
getConfigForSubkey ( string $subKey, array | mixed $default = [] ) : mixed Traverse an array for a subkey
getRenderer ( ) : Zend\View\Renderer\PhpRenderer Get a renderer instance
getRouteInfo ( RestServiceEntity $metadata, array $config ) Retrieve route information for a given service based on the configuration available
getRouteNameFilter ( ) : Zend\Filter\FilterChain Retrieve the filter chain for generating the route name
getSourcePath ( string $serviceName ) : string Get the source path for the module
injectResolver ( Zend\View\Renderer\PhpRenderer $renderer, string $type ) : string Inject the renderer with a resolver
mergeContentNegotiationConfig ( string $controllerServiceName, RestServiceEntity $metadata, array $config ) Merge the content negotiation configuration for the given controller service into the REST metadata
mergeHalConfig ( string $controllerServiceName, RestServiceEntity $metadata, array $config ) Merge entity and collection class into metadata, if found
routeAlreadyExist ( string $route, string $excludeRouteName = null ) : boolean Check if a route already exist in the configuration

Private Methods

Méthode Description
moduleNameToRegex ( ) : string Converts a module name (which could include namespace separators) into a string that can be used in regex matches. Use-cases: - Acme\Account => Acme\\Account - Acme\\Account (ideally it should never happen) => Acme\\Account - Acme => Acme

Method Details

__construct() public méthode

public __construct ( ModuleEntity $moduleEntity, ModulePathSpec $modules, ZF\Configuration\ConfigResource $config )
$moduleEntity ModuleEntity
$modules ModulePathSpec
$config ZF\Configuration\ConfigResource

__get() public méthode

Allow read-only access to properties
public __get ( string $name ) : mixed
$name string
Résultat mixed

createClassFile() protected méthode

Creates a class file based on the view model passed, the type of resource, and writes it to the path provided.
protected createClassFile ( Zend\View\Model\ViewModel $model, string $type, string $classPath ) : boolean
$model Zend\View\Model\ViewModel
$type string
$classPath string
Résultat boolean

createCollectionClass() public méthode

Create a collection class for the resource
public createCollectionClass ( string $serviceName ) : string
$serviceName string
Résultat string The name of the newly created collection class

createContentNegotiationConfig() public méthode

Create content negotiation configuration based on payload and discovered controller service name
public createContentNegotiationConfig ( RestServiceEntity $details, string $controllerService )
$details RestServiceEntity
$controllerService string

createControllerServiceName() public méthode

Generate the controller service name from the module and service name
public createControllerServiceName ( string $serviceName ) : string
$serviceName string
Résultat string

createEntityClass() public méthode

Create an entity class for the resource
public createEntityClass ( string $serviceName, string $template = 'entity', RestServiceEntity $details = null ) : string
$serviceName string
$template string Which template to use; defaults to 'entity'
$details RestServiceEntity
Résultat string The name of the newly created entity class

createFactoryClass() public méthode

public createFactoryClass ( $serviceName )

createHalConfig() public méthode

Create HAL configuration
public createHalConfig ( RestServiceEntity $details, string $entityClass, string $collectionClass, string $routeName )
$details RestServiceEntity
$entityClass string
$collectionClass string
$routeName string

createMediaType() public méthode

Based on the module and the latest module version.
public createMediaType ( ) : string
Résultat string

createResourceClass() public méthode

Creates a new resource class based on the specified service name
public createResourceClass ( string $serviceName ) : string
$serviceName string
Résultat string The name of the newly created class

createRestConfig() public méthode

Creates REST configuration
public createRestConfig ( RestServiceEntity $details, string $controllerService, string $resourceClass, string $routeName )
$details RestServiceEntity
$controllerService string
$resourceClass string
$routeName string

createRoute() public méthode

Create the route configuration
public createRoute ( string $serviceName, string $route, string $routeIdentifier, string $controllerService ) : string
$serviceName string
$route string
$routeIdentifier string
$controllerService string
Résultat string

createService() public méthode

Create a new service using the details provided
public createService ( RestServiceEntity $details ) : RestServiceEntity
$details RestServiceEntity
Résultat RestServiceEntity

deleteAuthorizationConfig() public méthode

Delete any authorization configuration for a service
public deleteAuthorizationConfig ( RestServiceEntity $entity )
$entity RestServiceEntity

deleteContentNegotiationConfig() public méthode

Delete content-negotiation configuration associated with a service
public deleteContentNegotiationConfig ( RestServiceEntity $entity )
$entity RestServiceEntity

deleteContentValidationConfig() public méthode

Delete content-validation configuration associated with a service
public deleteContentValidationConfig ( RestServiceEntity $entity )
$entity RestServiceEntity

deleteHalConfig() public méthode

Delete HAL configuration for the service
public deleteHalConfig ( RestServiceEntity $entity )
$entity RestServiceEntity

deleteRestConfig() public méthode

Delete the REST configuration associated with the given service
public deleteRestConfig ( RestServiceEntity $entity )
$entity RestServiceEntity

deleteRoute() public méthode

Delete the route associated with the given service
public deleteRoute ( RestServiceEntity $entity )
$entity RestServiceEntity

deleteService() public méthode

Delete a named service
public deleteService ( string $controllerService, boolean $recursive = false ) : true
$controllerService string
$recursive boolean
Résultat true

deleteServiceManagerConfig() public méthode

Delete any service manager configuration for the resource
public deleteServiceManagerConfig ( RestServiceEntity $entity )
$entity RestServiceEntity

deleteVersioningConfig() public méthode

Removes the route name from zf-versioning.
public deleteVersioningConfig ( RestServiceEntity $entity )
$entity RestServiceEntity

deriveCollectionClass() protected méthode

Derive the name of the collection class from the controller service name
protected deriveCollectionClass ( string $controllerServiceName, RestServiceEntity $metadata, array $config ) : string
$controllerServiceName string
$metadata RestServiceEntity
$config array
Résultat string

deriveEntityClass() protected méthode

Derive the name of the entity class from the controller service name
protected deriveEntityClass ( string $controllerServiceName, RestServiceEntity $metadata, array $config ) : string
$controllerServiceName string
$metadata RestServiceEntity
$config array
Résultat string

fetch() public méthode

public fetch ( string $controllerService, boolean $isAFetchOperation = true ) : RestServiceEntity | false
$controllerService string
$isAFetchOperation boolean If this is for a non-fetch operation, pass boolean false; allows listeners to include additional data necessary for clean updates.
Résultat RestServiceEntity | false

fetchAll() public méthode

Fetch all services
public fetchAll ( integer $version = null ) : RestServiceEntity[]
$version integer
Résultat RestServiceEntity[]

getConfigForSubkey() protected méthode

Subkey is given in "." notation, which is then split, and the configuration is traversed until no more keys are available, or a corresponding entry is not found; in the latter case, the $default will be provided.
protected getConfigForSubkey ( string $subKey, array | mixed $default = [] ) : mixed
$subKey string
$default array | mixed
Résultat mixed

getEventManager() public méthode

Lazy instantiates one if none currently registered
public getEventManager ( ) : Zend\EventManager\EventManagerInterface
Résultat Zend\EventManager\EventManagerInterface

getRenderer() protected méthode

Get a renderer instance
protected getRenderer ( ) : Zend\View\Renderer\PhpRenderer
Résultat Zend\View\Renderer\PhpRenderer

getRouteInfo() protected méthode

Retrieve route information for a given service based on the configuration available
protected getRouteInfo ( RestServiceEntity $metadata, array $config )
$metadata RestServiceEntity
$config array

getRouteNameFilter() protected méthode

Retrieve the filter chain for generating the route name
protected getRouteNameFilter ( ) : Zend\Filter\FilterChain
Résultat Zend\Filter\FilterChain

getSourcePath() protected méthode

Get the source path for the module
protected getSourcePath ( string $serviceName ) : string
$serviceName string
Résultat string

injectResolver() protected méthode

Seed the resolver with a template name and path based on the $type passed, and inject it into the renderer.
protected injectResolver ( Zend\View\Renderer\PhpRenderer $renderer, string $type ) : string
$renderer Zend\View\Renderer\PhpRenderer
$type string
Résultat string Template name

mergeContentNegotiationConfig() protected méthode

Merge the content negotiation configuration for the given controller service into the REST metadata
protected mergeContentNegotiationConfig ( string $controllerServiceName, RestServiceEntity $metadata, array $config )
$controllerServiceName string
$metadata RestServiceEntity
$config array

mergeHalConfig() protected méthode

Merge entity and collection class into metadata, if found
protected mergeHalConfig ( string $controllerServiceName, RestServiceEntity $metadata, array $config )
$controllerServiceName string
$metadata RestServiceEntity
$config array

routeAlreadyExist() protected méthode

Check if a route already exist in the configuration
protected routeAlreadyExist ( string $route, string $excludeRouteName = null ) : boolean
$route string
$excludeRouteName string
Résultat boolean

setEventManager() public méthode

Set the EventManager instance
public setEventManager ( Zend\EventManager\EventManagerInterface $events )
$events Zend\EventManager\EventManagerInterface

updateContentNegotiationConfig() public méthode

Update the content negotiation configuration for the service
public updateContentNegotiationConfig ( RestServiceEntity $original, RestServiceEntity $update )
$original RestServiceEntity
$update RestServiceEntity

updateHalConfig() public méthode

Update HAL configuration
public updateHalConfig ( RestServiceEntity $original, RestServiceEntity $update )
$original RestServiceEntity
$update RestServiceEntity

updateRestConfig() public méthode

Update REST configuration
public updateRestConfig ( RestServiceEntity $original, RestServiceEntity $update )
$original RestServiceEntity
$update RestServiceEntity

updateRoute() public méthode

Update the route for an existing service
public updateRoute ( RestServiceEntity $original, RestServiceEntity $update )
$original RestServiceEntity
$update RestServiceEntity

updateService() public méthode

Update an existing service
public updateService ( RestServiceEntity $update ) : RestServiceEntity
$update RestServiceEntity
Résultat RestServiceEntity

Property Details

$configResource protected_oe property

protected ConfigResource,ZF\Configuration $configResource
Résultat ZF\Configuration\ConfigResource

$events protected_oe property

protected EventManagerInterface,Zend\EventManager $events
Résultat Zend\EventManager\EventManagerInterface

$module protected_oe property

protected string $module
Résultat string

$moduleEntity protected_oe property

protected ModuleEntity,ZF\Apigility\Admin\Model $moduleEntity
Résultat ModuleEntity

$modulePath protected_oe property

protected string $modulePath
Résultat string

$modules protected_oe property

protected ModulePathSpec,ZF\Apigility\Admin\Model $modules
Résultat ModulePathSpec

$renderer protected_oe property

protected PhpRenderer,Zend\View\Renderer $renderer
Résultat Zend\View\Renderer\PhpRenderer

$restArrayUpdateOptions protected_oe property

Allowed REST update options that are arrays
protected array $restArrayUpdateOptions
Résultat array

$restScalarUpdateOptions protected_oe property

Allowed REST update options that are scalars
protected array $restScalarUpdateOptions
Résultat array

$routeNameFilter protected_oe property

protected FilterChain,Zend\Filter $routeNameFilter
Résultat Zend\Filter\FilterChain