Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setShopId example
$customer
->
setId
(
$data
[
'__customer_id'
]
)
;
$customer
->
setEncoder
(
$data
[
'__customer_encoder'
]
)
;
$customer
->
setEmail
(
$data
[
'__customer_email'
]
)
;
$customer
->
setActive
(
$data
[
'__customer_active'
]
)
;
$customer
->
setAccountMode
(
$data
[
'__customer_accountmode'
]
)
;
$customer
->
setConfirmationKey
(
$data
[
'__customer_confirmationkey'
]
)
;
$customer
->
setPaymentId
(
$data
[
'__customer_paymentID'
]
)
;
$customer
->
setValidation
(
$data
[
'__customer_validation'
]
)
;
$customer
->
setAffiliate
(
$data
[
'__customer_affiliate'
]
)
;
$customer
->
setPaymentPreset
(
$data
[
'__customer_paymentpreset'
]
)
;
$customer
->
setLanguageId
(
$data
[
'__customer_language'
]
)
;
$customer
->
setShopId
(
$data
[
'__customer_subshopID'
]
)
;
$customer
->
setReferer
(
$data
[
'__customer_referer'
]
)
;
$customer
->
setInternalComment
(
$data
[
'__customer_internalcomment'
]
)
;
$customer
->
setFailedLogins
(
$data
[
'__customer_failedlogins'
]
)
;
$customer
->
setDefaultBillingAddressId
(
$data
[
'__customer_default_billing_address_id'
]
)
;
$customer
->
setDefaultShippingAddressId
(
$data
[
'__customer_default_shipping_address_id'
]
)
;
$customer
->
setTitle
(
$data
[
'__customer_title'
]
)
;
$customer
->
setSalutation
(
$data
[
'__customer_salutation'
]
)
;
$customer
->
setFirstname
(
$data
[
'__customer_firstname'
]
)
;
$customer
->
setLastname
(
$data
[
'__customer_lastname'
]
)
;
$customer
->
setNumber
(
$data
[
'__customer_customernumber'
]
)
;
$customer
->
setNewsletter
(
(bool)
$data
[
'__active_campaign'
]
)
;
/** @var Value|null $valueModel */
$valueModel
=
$valueRepository
->
findOneBy
(
[
'shopId' =>
$shopId
, 'element' =>
$element
]
)
;
if
(
$valueModel
=== null
)
{
if
(
$value
===
$parentValue
||
$value
=== null
)
{
return
;
}
$valueModel
=
new
Value
(
)
;
$valueModel
->
setElement
(
$element
)
;
$valueModel
->
setShopId
(
$shopId
)
;
// serialize done by Doctrine
$valueModel
->
setValue
(
$value
)
;
$this
->modelManager->
persist
(
$valueModel
)
;
try
{
$this
->modelManager->
flush
(
$valueModel
)
;
}
catch
(
OptimisticLockException
$e
)
{
throw
new
WriterException
(
'Failed writing to database', 0,
$e
)
;
}
return
;
}
public
function
__construct
(
$articleId
,
$shopId
,
$date
= null,
$impressions
= 1,
$deviceType
= null
)
{
if
(
$date
=== null
)
{
$date
=
new
DateTime
(
)
;
}
$this
->
setArticleId
(
$articleId
)
;
$this
->
setShopId
(
$shopId
)
;
$this
->
setDate
(
$date
)
;
$this
->
setImpressions
(
$impressions
)
;
$this
->
setDeviceType
(
$deviceType
)
;
}
/** * Get the Id * * @return int */
public
function
getId
(
)
{
return
[
]
;
}
$hrefs
=
[
]
;
foreach
(
$shops
as
$languageShop
)
{
$shop
=
$this
->
getDetachedShop
(
$languageShop
[
'id'
]
)
;
$config
->
setShop
(
$shop
)
;
$href
=
new
HrefLang
(
)
;
$href
->
setShopId
(
$languageShop
[
'id'
]
)
;
$href
->
setLocale
(
$languageShop
[
'locale'
]
)
;
$routingContext
=
$this
->
getContext
(
$shop
,
$config
)
;
$href
->
setLink
(
$this
->
filterUrl
(
(string)
$this
->rewriteRouter->
assemble
(
$parameters
,
$routingContext
)
,
$parameters
)
)
;
if
(
!
$config
->
get
(
'hrefLangCountry'
)
)
{
$href
->
setLocale
(
explode
(
'-',
$languageShop
[
'locale'
]
)
[
0
]
)
;
}
if
(
(int)
$languageShop
[
'id'
]
===
$config
->
get
(
'hrefLangDefaultShop'
)
)
{
$href
->
setLocale
(
'x-default'
)
;
}
/** * @return Context */
public
static
function
createFromShop
(
ShopwareShop
$shop
, ShopwareConfig
$config
)
{
$self
=
new
self
(
$shop
->
getHost
(
)
?? 'localhost',
$shop
->
getBaseUrl
(
)
?? '',
$shop
->
getSecure
(
)
,
[
]
)
;
$self
->
setShopId
(
$shop
->
getId
(
)
)
;
$self
->
setUrlToLower
(
$config
->
get
(
'routerToLower'
)
)
;
$self
->
setBaseFile
(
$config
->
get
(
'baseFile'
)
)
;
$self
->
setRemoveCategory
(
(bool)
$config
->
get
(
'routerRemoveCategory'
)
)
;
return
$self
;
}
}
string
$appSecret
,
string
$shopId
,
string
$actionId
)
{
$this
->
setAction
(
$action
)
;
$this
->
setAppVersion
(
$appVersion
)
;
$this
->
setEntity
(
$entity
)
;
$this
->
setIds
(
$ids
)
;
$this
->
setShopUrl
(
$shopUrl
)
;
$this
->
setTargetUrl
(
$targetUrl
)
;
$this
->
setAppSecret
(
$appSecret
)
;
$this
->
setShopId
(
$shopId
)
;
$this
->
setActionId
(
$actionId
)
;
}
public
function
getTargetUrl
(
)
: string
{
return
$this
->targetUrl;
}
public
function
asPayload
(
)
: array
{
return
[