Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getCustomerScope example
$this
->db =
$db
?:
Shopware
(
)
->
Db
(
)
;
$this
->eventManager =
$eventManager
?:
Shopware
(
)
->
Events
(
)
;
$this
->config =
$config
?:
Shopware
(
)
->
Config
(
)
;
$this
->session =
$session
?:
Shopware
(
)
->
Session
(
)
;
$this
->front =
$front
?:
Shopware
(
)
->
Front
(
)
;
$this
->passwordEncoder =
$passwordEncoder
?:
Shopware
(
)
->
PasswordEncoder
(
)
;
$this
->snippetManager =
$snippetManager
?:
Shopware
(
)
->
Snippets
(
)
;
$this
->moduleManager =
$moduleManager
?:
Shopware
(
)
->
Modules
(
)
;
$this
->sSYSTEM =
$systemModule
?:
Shopware
(
)
->
System
(
)
;
$mainShop
=
Shopware
(
)
->
Shop
(
)
->
getMain
(
)
!== null ?
Shopware
(
)
->
Shop
(
)
->
getMain
(
)
:
Shopware
(
)
->
Shop
(
)
;
$this
->scopedRegistration =
$mainShop
->
getCustomerScope
(
)
;
$this
->contextService =
$contextService
?:
Shopware
(
)
->
Container
(
)
->
get
(
ContextServiceInterface::
class
)
;
$this
->emailValidator =
$emailValidator
?:
Shopware
(
)
->
Container
(
)
->
get
(
EmailValidator::
class
)
;
$this
->subshopId =
$this
->contextService->
getShopContext
(
)
->
getShop
(
)
->
getParentId
(
)
;
$this
->attributeLoader =
Shopware
(
)
->
Container
(
)
->
get
(
DataLoader::
class
)
;
$this
->translationComponent =
$translationComponent
?:
Shopware
(
)
->
Container
(
)
->
get
(
\Shopware_Components_Translation::
class
)
;
$this
->connection =
$connection
?:
Shopware
(
)
->
Container
(
)
->
get
(
Connection::
class
)
;
$this
->optInLoginService =
$optInLoginService
?:
Shopware
(
)
->
Container
(
)
->
get
(
OptInLoginService::
class
)
;
$this
->conditionalLineItemService =
Shopware
(
)
->
Container
(
)
->
get
(
ConditionalLineItemServiceInterface::
class
)
;
$this
->cartOrderNumberProvider =
Shopware
(
)
->
Container
(
)
->
get
(
CartOrderNumberProviderInterface::
class
)
;
$this
->csrfTokenValidator =
$csrfTokenValidator
?:
Shopware
(
)
->
Container
(
)
->
get
(
CSRFTokenValidator::
class
)
;
$shop
= DetachedShop::
createFromShop
(
$shop
)
;
$main
=
$shop
->
getMain
(
)
;
if
(
$main
!== null
)
{
$main
= DetachedShop::
createFromShop
(
$main
)
;
$shop
->
setHost
(
$main
->
getHost
(
)
)
;
$shop
->
setSecure
(
$main
->
getSecure
(
)
)
;
$shop
->
setBasePath
(
$shop
->
getBasePath
(
)
?:
$main
->
getBasePath
(
)
)
;
$shop
->
setTemplate
(
$main
->
getTemplate
(
)
)
;
$shop
->
setCurrencies
(
$main
->
getCurrencies
(
)
)
;
$shop
->
setChildren
(
$main
->
getChildren
(
)
)
;
$shop
->
setCustomerScope
(
$main
->
getCustomerScope
(
)
)
;
}
$shop
->
setBaseUrl
(
$shop
->
getBaseUrl
(
)
?:
$shop
->
getBasePath
(
)
)
;
return
DetachedShop::
createFromShop
(
$shop
)
;
}
/** * returns the right shop depending on the request object * * @param array[] $shops * @param string $requestPath * * @return array|null */
protected
$customerScope
;
/** * @return Shop */
public
static
function
createFromShopEntity
(
ShopEntity
$shop
)
{
$struct
=
new
self
(
)
;
$struct
->
setId
(
$shop
->
getId
(
)
)
;
$struct
->
setParentId
(
$shop
->
getMain
(
)
?
$shop
->
getMain
(
)
->
getId
(
)
:
$shop
->
getId
(
)
)
;
$struct
->
setCustomerScope
(
$shop
->
getMain
(
)
?
$shop
->
getMain
(
)
->
getCustomerScope
(
)
:
$shop
->
getCustomerScope
(
)
)
;
$struct
->
setIsDefault
(
$shop
->
getDefault
(
)
)
;
$struct
->
setName
(
$shop
->
getName
(
)
)
;
$struct
->
setHost
(
$shop
->
getHost
(
)
)
;
$struct
->
setPath
(
$shop
->
getBasePath
(
)
)
;
$struct
->
setUrl
(
$shop
->
getBaseUrl
(
)
)
;
$struct
->
setSecure
(
$shop
->
getSecure
(
)
)
;
if
(
$shop
->
getCategory
(
)
)
{
$struct
->
setCategory
(
Category::
createFromCategoryEntity
(
$shop
->
getCategory
(
)
)
)
;
}