com\setasign\Konquadrat
Di Application Di for Konquadrat
File: /Konquadrat/src/Di.php
You shouldn't use this class for anything (no typehints! no instanceof!). Use \com\setasign\SetaFramework\Di\Di instead!
Class hierarchy
- com\setasign\SetaFramework\Application\ApplicationDi
Summary
Methods
- __construct()
- __sleep()
- __wakeup()
- addAlias()
- addAliasWithInstancedObject()
- call()
- callNewInstance()
- clearInstance()
- configure()
- createClassBuilder()
- createDatabase()
- createLanguageManager()
- createObjectConfig()
- createObjectConfigLoader()
- createObjectFinder()
- createObjectManager()
- createPersistantDatabaseManager()
- createPersistantRegistry()
- createSession()
- createSmarty()
- createSwiftMailer()
- createSymfonyMailer()
- createTransactionManager()
- createView()
- createViewTwigEnvironment()
- createWakeupResolver()
- createWorkflowFactory()
- get()
- getArguments()
- getByAlias()
- getByClassName()
- getDatabaseConnectionManager()
- getEventManager()
- getReflectionParameters()
- hasAlias()
- hasConfiguration()
- hasInstance()
- init()
- parentInjections()
- prepareParams()
- purgeName()
- remove()
- setupApplicationCacheHandler()
- setupApplicationLogHandler()
- setupCacheHandler()
- setupLogHandler()
Properties
$aliases
-
An array of aliases configurations
$configures
-
An array of classes/interfaces configurations
$instances
-
An internal cache of singleton instances
Methods
__construct()
-
\com\setasign\SetaFramework\Bootstrap\Bootstrap $bootstrap
ApplicationDi constructor.
Parameters
- $application : \com\setasign\SetaFramework\Application\ApplicationInterface
- $bootstrap : \com\setasign\SetaFramework\Bootstrap\Bootstrap
addAlias()
-
string|callable $classNameOrCallback,
array $params = array ( ),
bool $singleton = true
Add an alias configuration
Parameters
- $name : string
- $classNameOrCallback : string|callable
- $params : array
- $singleton : bool
Exceptions
Throws \com\setasign\SetaFramework\Di\AlreadyDefinedException
addAliasWithInstancedObject()
-
?object $instance
Parameters
- $name : string
- $instance : ?object
call()
-
array $parameters = array ( )
Call the callable and autowire the params.
Parameters
- $callable : callable
- $parameters : array
Return Values
Result of the callable
Exceptions
Throws \ReflectionException
callNewInstance()
-
array $parameters = array ( )
Create a new instance of $className and autowire the params.
Parameters
- $className : \com\setasign\SetaFramework\Di\class-string<\com\setasign\SetaFramework\Di\T>
- $parameters : array
Exceptions
Throws \ReflectionException
configure()
-
array $params = array ( ),
bool $singleton = true
Add a class/interface configuration
Parameters
- $className : string
- $params : array
- $singleton : bool
Exceptions
Throws \com\setasign\SetaFramework\Di\AlreadyDefinedException
createClassBuilder()
Parameters
- $directorySettings : DirectorySettings
- $languageManager : LanguageManager
Exceptions
Throws \ReflectionException
createDatabase()
\com\setasign\SetaFramework\Application\ApplicationConfig $applicationConfig
Parameters
- $connectionManager : \com\setasign\SetaFramework\Database\DatabaseConnectionManager
- $applicationConfig : \com\setasign\SetaFramework\Application\ApplicationConfig
Exceptions
Throws \com\setasign\SetaFramework\Database\ConnectionException
createLanguageManager()
?\com\setasign\SetaFramework\Session\SessionInterface $session
Parameters
- $applicationConfig : \com\setasign\SetaFramework\Application\ApplicationConfig
- $session : ?\com\setasign\SetaFramework\Session\SessionInterface
createObjectConfig()
Parameters
- $config : Config\Loader
createObjectConfigLoader()
Konquadrat $konquadrat,
LanguageManager $languageManager
Parameters
- $persistantDatabase : \com\setasign\SetaFramework\Registry\PersistantDatabase
- $konquadrat : Konquadrat
- $languageManager : LanguageManager
Exceptions
Throws \Smarty\Exception
Throws \Throwable
createObjectFinder()
Parameters
- $logHandler : \com\setasign\SetaFramework\Log\ApplicationLogHandler
Exceptions
Throws \Throwable
createObjectManager()
Parameters
- $logHandler : \com\setasign\SetaFramework\Log\ApplicationLogHandler
Exceptions
Throws \Throwable
createPersistantDatabaseManager()
\com\setasign\SetaFramework\Database\TableFactoryInterface $tableFactory
Parameters
- $db : \com\setasign\SetaFramework\Database\Database
- $tableFactory : \com\setasign\SetaFramework\Database\TableFactoryInterface
Exceptions
Throws \com\setasign\SetaFramework\Database\Manager\TableSchemaBuilderException
Throws \com\setasign\SetaFramework\Exception
createPersistantRegistry()
\com\setasign\SetaFramework\Registry\PersistantDatabaseManager $persistantDatabaseManager
Parameters
- $konquadrat : Konquadrat
- $persistantDatabaseManager : \com\setasign\SetaFramework\Registry\PersistantDatabaseManager
Exceptions
Throws \com\setasign\SetaFramework\Exception
createSession()
Konquadrat $konquadrat,
\com\setasign\SetaFramework\Request\ServerRequest $request
Parameters
- $applicationConfig : \com\setasign\SetaFramework\Application\ApplicationConfig
- $konquadrat : Konquadrat
- $request : \com\setasign\SetaFramework\Request\ServerRequest
createSmarty()
Smarty\Noun $noun,
Smarty\DateTime $dateTime,
Smarty\CssClasses $cssClasses,
\com\setasign\SetaFramework\View\Helper\CsrfFormField $csrfFormField,
\com\setasign\SetaFramework\Bootstrap\DomainName $domainName
Parameters
- $applicationConfig : \com\setasign\SetaFramework\Application\ApplicationConfig
- $noun : Smarty\Noun
- $dateTime : Smarty\DateTime
- $cssClasses : Smarty\CssClasses
- $csrfFormField : \com\setasign\SetaFramework\View\Helper\CsrfFormField
- $domainName : \com\setasign\SetaFramework\Bootstrap\DomainName
Exceptions
Throws \Smarty\Exception
createSwiftMailer()
Parameters
- $applicationConfig : \com\setasign\SetaFramework\Application\ApplicationConfig
Exceptions
Throws \Smarty\Exception
createSymfonyMailer()
Parameters
- $applicationConfig : \com\setasign\SetaFramework\Application\ApplicationConfig
createTransactionManager()
\com\setasign\SetaFramework\Log\ApplicationLogHandler $logHandler
Parameters
- $db : \com\setasign\SetaFramework\Database\Database
- $logHandler : \com\setasign\SetaFramework\Log\ApplicationLogHandler
createView()
-
Parameters
- $application : \com\setasign\SetaFramework\Application\HttpApplicationInterface
createViewTwigEnvironment()
-
\com\setasign\SetaFramework\Bootstrap\Bootstrap $bootstrap,
\com\setasign\SetaFramework\Application\ApplicationConfig $applicationConfig,
\com\setasign\SetaFramework\Bootstrap\DomainName $domainName
Parameters
- $application : \com\setasign\SetaFramework\Application\ApplicationInterface
- $bootstrap : \com\setasign\SetaFramework\Bootstrap\Bootstrap
- $applicationConfig : \com\setasign\SetaFramework\Application\ApplicationConfig
- $domainName : \com\setasign\SetaFramework\Bootstrap\DomainName
createWakeupResolver()
createWorkflowFactory()
Parameters
- $cacheHandler : \com\setasign\SetaFramework\SimpleCache\ApplicationCacheHandler
Exceptions
Throws \Throwable
get()
-
array $params = array ( ),
?bool $singleton = null
Get an instance by class name or alias.
If singleton is false, Di will create everytime a new object.
Di will remember up to one instance of every class/alias (except $singleton is false).
If you use an alias or a class that has a configuration, $params will be merged with the params of the configuration or alias.
If the di has already an instance, the $params will be ignored because no new object is created.
Parameters
- $classNameOrAlias : string|\com\setasign\SetaFramework\Di\class-string<\com\setasign\SetaFramework\Di\T>
- $params : array
- $singleton : ?bool
Use null to use the configured value, or true/false to affect this behaviour
Exceptions
Throws \com\setasign\SetaFramework\Di\UnknownClassOrAliasException if alias wasn't found.
Throws \com\setasign\SetaFramework\Di\DiClassConstructionException if an exception occurs on constructing a new instance.
Throws \com\setasign\SetaFramework\Bootstrap\MaintenanceException
getArguments()
-
array $parameters
Parameters
- $reflectionParameters : array<string, \com\setasign\SetaFramework\Di\ReflectionParameter>
- $parameters : array
getByAlias()
-
array $params,
?bool $singleton
Get an instance by an alias
If the alias is definied to be a singleton the $params array is ignored if the instance was already created.
Parameters
- $name : string
- $params : array
- $singleton : ?bool
Use null to use the configured value, or true/false to affect this behaviour
Exceptions
Throws \com\setasign\SetaFramework\Di\UnknownClassOrAliasException if alias wasn't found.
Throws \com\setasign\SetaFramework\Di\DiClassConstructionException if an exception occurs on constructing a new instance.
Throws \com\setasign\SetaFramework\Bootstrap\MaintenanceException
getByClassName()
-
array $params,
?bool $singleton
Get an instance by a class name
If the class is definied to be a singleton the $params array is ignored if the instance was already created.
Parameters
- $className : \com\setasign\SetaFramework\Di\class-string<\com\setasign\SetaFramework\Di\T>
- $params : array
- $singleton : ?bool
Use null to use the configured value, or true/false to affect this behaviour
Exceptions
Throws \com\setasign\SetaFramework\Di\UnknownClassOrAliasException if alias wasn't found.
Throws \com\setasign\SetaFramework\Di\DiClassConstructionException if an exception occurs on constructing a new instance.
Throws \com\setasign\SetaFramework\Bootstrap\MaintenanceException
getDatabaseConnectionManager()
-
Parameters
- $bootstrap : \com\setasign\SetaFramework\Bootstrap\Bootstrap
getEventManager()
-
Parameters
- $bootstrap : \com\setasign\SetaFramework\Bootstrap\Bootstrap
getReflectionParameters()
-
Parameters
- $callable : array{0: \com\setasign\SetaFramework\Di\class-string|object, 1: string}|callable
Exceptions
Throws \ReflectionException
hasAlias()
-
Checks whether the di contains a alias with this name
Parameters
- $name : string
hasConfiguration()
-
Checks whether the di has a configuration for this class
Parameters
- $className : string
hasInstance()
-
Checks whether the di has an instance for this alias or className
Parameters
- $aliasOrClassname : string
parentInjections()
-
array $parameters = array ( )
Parameters
- $parentClassName : string
- $parameters : array
Exceptions
Throws \ReflectionException
prepareParams()
-
array $defaultParams = array ( )
Prepares inject parameters
Internally aliases will be automatically resolved.
Parameters
- $params : array
- $defaultParams : array
Exceptions
Throws \com\setasign\SetaFramework\Di\UnknownClassOrAliasException
purgeName()
-
Parameters
- $name : string
remove()
-
Removes all added configurations, aliases and instances with this name.
Parameters
- $classNameOrAlias : string
setupApplicationCacheHandler()
-
\com\setasign\SetaFramework\Application\HttpApplicationInterface $application
Parameters
- $cacheHandler : \com\setasign\SetaFramework\SimpleCache\CacheHandler
- $application : \com\setasign\SetaFramework\Application\HttpApplicationInterface
setupApplicationLogHandler()
-
\com\setasign\SetaFramework\Application\HttpApplicationInterface $application
Parameters
- $logHandler : \com\setasign\SetaFramework\Log\LogHandler
- $application : \com\setasign\SetaFramework\Application\HttpApplicationInterface
setupCacheHandler()
-
Parameters
- $bootstrap : \com\setasign\SetaFramework\Bootstrap\Bootstrap
setupLogHandler()
-
Parameters
- $bootstrap : \com\setasign\SetaFramework\Bootstrap\Bootstrap
