Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
Hooks example
$class
=
$path
;
$path
= null;
}
if
(
!\
is_object
(
$class
)
)
{
try
{
Shopware
(
)
->
Loader
(
)
->
loadClass
(
$class
,
$path
)
;
}
catch
(
Exception
$e
)
{
throw
new
Enlight_Exception
(
sprintf
(
'Controller "%s" could not be loaded',
$class
)
)
;
}
$proxy
=
Shopware
(
)
->
Hooks
(
)
->
getProxy
(
$class
)
;
/** @var Enlight_Controller_Action $controller */
$controller
=
new
$proxy
(
)
;
}
else
{
/** @var Enlight_Controller_Action $controller */
$controller
=
$class
;
}
if
(
$controller
instanceof ContainerAwareInterface
)
{
$container
=
Shopware
(
)
->
Container
(
)
;
$controller
->
setContainer
(
$container
)
;
}
$plugin
->
setUpdated
(
new
DateTime
(
)
)
;
$em
->
flush
(
$plugin
)
;
$this
->
write
(
)
;
$em
->
flush
(
)
;
$this
->
Application
(
)
->
Container
(
)
->
get
(
DatabaseHandler::
class
)
->
loadToDatabase
(
$bootstrap
->
Path
(
)
. 'Snippets/'
)
;
$this
->
Application
(
)
->
Container
(
)
->
get
(
DatabaseHandler::
class
)
->
loadToDatabase
(
$bootstrap
->
Path
(
)
. 'snippets/'
)
;
$this
->
Application
(
)
->
Container
(
)
->
get
(
DatabaseHandler::
class
)
->
loadToDatabase
(
$bootstrap
->
Path
(
)
. 'Resources/snippet/'
)
;
// Clear proxy cache
$this
->
Application
(
)
->
Hooks
(
)
->
getProxyFactory
(
)
->
clearCache
(
)
;
}
$db
=
$this
->
Application
(
)
->
Container
(
)
->
get
(
'db'
)
;
$resourceId
=
$db
->
fetchOne
(
"SELECT id FROM s_core_acl_resources WHERE name = 'widgets'"
)
;
if
(
!
$resourceId
)
{
return
$result
;
}
private
function
loadModule
(
string
$name
)
: void
{
if
(
$name
=== 'sSystem'
)
{
$this
->modules_container
[
$name
]
=
$this
->system;
return
;
}
Shopware
(
)
->
Hooks
(
)
->
setAlias
(
$name
,
$name
)
;
$proxy
=
Shopware
(
)
->
Hooks
(
)
->
getProxy
(
$name
)
;
$this
->modules_container
[
$name
]
=
new
$proxy
(
)
;
if
(
property_exists
(
$this
->modules_container
[
$name
]
, 'sSYSTEM'
)
)
{
$this
->modules_container
[
$name
]
->sSYSTEM =
$this
->system;
}
}
}
if
(
$this
instanceof Enlight_Singleton
)
{
if
(
!
isset
(
self::
$instances
[
$class
]
)
)
{
self::
$instances
[
$class
]
=
$this
;
}
else
{
throw
new
Enlight_Exception
(
'Class "' . \
get_class
(
$this
)
. '" is singleton, please use the instance method'
)
;
}
}
if
(
$this
instanceof Enlight_Hook
&& !
$this
instanceof Enlight_Hook_Proxy
&&
Shopware
(
)
->
Hooks
(
)
->
hasProxy
(
$class
)
)
{
throw
new
Enlight_Exception
(
'Class "' . \
get_class
(
$this
)
. '" has hooks, please use the instance method'
)
;
}
if
(
method_exists
(
$this
, 'init'
)
)
{
if
(
\
func_num_args
(
)
)
{
\
call_user_func_array
(
[
$this
, 'init'
]
, \
func_get_args
(
)
)
;
}
else
{
$this
->
init
(
)
;
}
}