Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setCashed example
public
function
updateVoucherCodesAction
(
)
{
$codeId
=
(int)
$this
->
Request
(
)
->
getParam
(
'id'
)
;
$code
=
$this
->
get
(
ModelManager::
class
)
->
getRepository
(
Code::
class
)
->
find
(
$codeId
)
;
if
(
!
$code
instanceof Code
)
{
$this
->
View
(
)
->
assign
(
[
'success' => false
]
)
;
return
;
}
$code
->
setCashed
(
$this
->
Request
(
)
->
getParam
(
'cashed'
)
)
;
$code
->
setCode
(
$this
->
Request
(
)
->
getParam
(
'code'
)
)
;
$code
->
setCustomerId
(
$this
->
Request
(
)
->
getParam
(
'customerId'
)
)
;
$this
->
get
(
ModelManager::
class
)
->
persist
(
$code
)
;
$this
->
get
(
ModelManager::
class
)
->
flush
(
$code
)
;
$this
->
View
(
)
->
assign
(
[
'success' => true
]
)
;
}
/** * exports all voucher codes via csv * * @return void */