PHP 클래스 CRUDlex\ServiceProvider

After adding it to your Silex-setup, it offers access to {@see \AbstractData} instances, one for each defined entity off the CRUD YAML file.
상속: implements Pimple\ServiceProviderInterface
파일 보기 프로젝트 열기: philiplb/crudlex 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$datas Holds the {@see AbstractData} instances.
$manageI18n Holds whether we manage the i18n.

공개 메소드들

메소드 설명
getData ( string $name ) : AbstractData Getter for the {@see AbstractData} instances.
getEntities ( ) : string[] Getter for all available entity names.
getLocales ( ) : array Gets the available locales.
getTemplate ( Pimple\Container $app, string $section, string $action, string $entity ) : string Determines the Twig template to use for the given parameters depending on the existance of certain keys in the Container $app in this order:
init ( crudlex\DataFactoryInterface $dataFactory, string $crudFile, crudlex\FileProcessorInterface $fileProcessor, boolean $manageI18n, Pimple\Container $app ) Initializes the instance.
isManagingI18n ( ) : boolean Gets whether CRUDlex manages the i18n system.
register ( Pimple\Container $app ) Implements ServiceProviderInterface::register() registering $app['crud'].
setLocale ( string $locale ) Sets the locale to be used.

보호된 메소드들

메소드 설명
configureDefinition ( EntityDefinition $definition, array $crud ) Configures the EntityDefinition according to the given CRUD entity map.
createDefinition ( Pimple\Container $app, array $locales, array $crud, string $name ) : EntityDefinition Creates and setups an EntityDefinition instance.
getLocaleLabels ( array $locales, array $crud ) : array Gets a map with localized entity labels from the CRUD YML.
initChildren ( ) Initializes the children of the data entries.
initLocales ( Pimple\Container $app ) : array Initializes the available locales.
initMissingServiceProviders ( Pimple\Container $app ) Initializes needed but yet missing service providers.
readYaml ( string $fileName ) : array Reads and returns the contents of the given Yaml file. If it goes wrong, it throws an exception.
validateEntityDefinition ( Pimple\Container $app, array $entityDefinition ) Validates the parsed entity definition.

메소드 상세

configureDefinition() 보호된 메소드

Configures the EntityDefinition according to the given CRUD entity map.
protected configureDefinition ( EntityDefinition $definition, array $crud )
$definition EntityDefinition the definition to configure
$crud array the CRUD entity map

createDefinition() 보호된 메소드

Creates and setups an EntityDefinition instance.
protected createDefinition ( Pimple\Container $app, array $locales, array $crud, string $name ) : EntityDefinition
$app Pimple\Container the application container
$locales array the available locales
$crud array the parsed YAML of a CRUD entity
$name string the name of the entity
리턴 EntityDefinition the EntityDefinition good to go

getData() 공개 메소드

Getter for the {@see AbstractData} instances.
public getData ( string $name ) : AbstractData
$name string the entity name of the desired Data instance
리턴 AbstractData the AbstractData instance or null on invalid name

getEntities() 공개 메소드

Getter for all available entity names.
public getEntities ( ) : string[]
리턴 string[] a list of all available entity names

getLocaleLabels() 보호된 메소드

Gets a map with localized entity labels from the CRUD YML.
protected getLocaleLabels ( array $locales, array $crud ) : array
$locales array the available locales
$crud array the CRUD entity map
리턴 array the map with localized entity labels

getLocales() 공개 메소드

Gets the available locales.
public getLocales ( ) : array
리턴 array the available locales

getTemplate() 공개 메소드

crud.$section.$action.$entity crud.$section.$action crud.$section If nothing exists, this string is returned: "@crud/.twig"
public getTemplate ( Pimple\Container $app, string $section, string $action, string $entity ) : string
$app Pimple\Container the Silex application
$section string the section of the template, either "layout" or "template"
$action string the current calling action like "create" or "show"
$entity string the current calling entity
리턴 string the best fitting template

init() 공개 메소드

Initializes the instance.
public init ( crudlex\DataFactoryInterface $dataFactory, string $crudFile, crudlex\FileProcessorInterface $fileProcessor, boolean $manageI18n, Pimple\Container $app )
$dataFactory crudlex\DataFactoryInterface the factory to create the concrete AbstractData instances
$crudFile string the CRUD YAML file to parse
$fileProcessor crudlex\FileProcessorInterface the file processor used for file fields
$manageI18n boolean holds whether we manage the i18n
$app Pimple\Container the application container

initChildren() 보호된 메소드

Initializes the children of the data entries.
protected initChildren ( )

initLocales() 보호된 메소드

Initializes the available locales.
protected initLocales ( Pimple\Container $app ) : array
$app Pimple\Container the application container
리턴 array the available locales

initMissingServiceProviders() 보호된 메소드

Initializes needed but yet missing service providers.
protected initMissingServiceProviders ( Pimple\Container $app )
$app Pimple\Container the application container

isManagingI18n() 공개 메소드

Gets whether CRUDlex manages the i18n system.
public isManagingI18n ( ) : boolean
리턴 boolean true if CRUDlex manages the i18n system

readYaml() 보호된 메소드

Reads and returns the contents of the given Yaml file. If it goes wrong, it throws an exception.
protected readYaml ( string $fileName ) : array
$fileName string the file to read
리턴 array the file contents

register() 공개 메소드

$app['crud'] contains an instance of the ServiceProvider afterwards.
public register ( Pimple\Container $app )
$app Pimple\Container the Container instance of the Silex application

setLocale() 공개 메소드

Sets the locale to be used.
public setLocale ( string $locale )
$locale string the locale to be used.

validateEntityDefinition() 보호된 메소드

Validates the parsed entity definition.
protected validateEntityDefinition ( Pimple\Container $app, array $entityDefinition )
$app Pimple\Container the application container
$entityDefinition array the entity definition to validate

프로퍼티 상세

$datas 보호되어 있는 프로퍼티

Holds the {@see AbstractData} instances.
protected $datas

$manageI18n 보호되어 있는 프로퍼티

Holds whether we manage the i18n.
protected $manageI18n