Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
addAdapter example
public
function
onInitResourceAuth
(
Enlight_Event_EventArgs
$args
)
{
/** @var Enlight_Components_Session_Namespace $session */
$session
=
Shopware
(
)
->
Container
(
)
->
get
(
'backendsession'
)
;
$resource
= Shopware_Components_Auth::
getInstance
(
)
;
$adapter
=
new
Shopware_Components_Auth_Adapter_Default
(
$session
)
;
$storage
=
new
Zend_Auth_Storage_Session
(
$session
)
;
$resource
->
setBaseAdapter
(
$adapter
)
;
$resource
->
addAdapter
(
$adapter
)
;
$resource
->
setStorage
(
$storage
)
;
$this
->
registerAclPlugin
(
$resource
)
;
return
$resource
;
}
public
function
getCapabilities
(
)
{
return
[
'install' => false,
public
static
function
resetInstances
(
)
: void
{
static
::
clearInstancesMemory
(
)
;
static
::
$instances
=
[
]
;
}
public
function
create
(
array
$config
)
: FilesystemAdapter
{
$adapter
=
new
MemoryFilesystemAdapter
(
)
;
static
::
addAdapter
(
$adapter
)
;
return
$adapter
;
}
public
function
getType
(
)
: string
{
return
'memory';
}
private
static
function
addAdapter
(
MemoryFilesystemAdapter
$adapter
)
: void
{
new
StaticResolver
(
$this
->
get
(
ModelManager::
class
)
)
)
;
$adapter
->
setRequest
(
$this
->request
)
;
$adapter
->
setResponse
(
$this
->response
)
;
$resource
= Shopware_Components_Auth::
getInstance
(
)
;
$storage
=
new
Zend_Auth_Storage_NonPersistent
(
)
;
$resource
->
setBaseAdapter
(
$adapter
)
;
$resource
->
addAdapter
(
$adapter
)
;
$resource
->
setStorage
(
$storage
)
;
return
$resource
;
}
}