Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setRecords example
ImportExportFileEntity
$file
,
ImportExportProfileEntity
$profile
,
array
$config
)
: ImportExportLogEntity
{
$logEntity
=
new
ImportExportLogEntity
(
)
;
$logEntity
->
setId
(
Uuid::
randomHex
(
)
)
;
$logEntity
->
setActivity
(
$activity
)
;
$logEntity
->
setState
(
Progress::STATE_PROGRESS
)
;
$logEntity
->
setProfileId
(
$profile
->
getId
(
)
)
;
$logEntity
->
setProfileName
(
$profile
->
getTranslation
(
'label'
)
)
;
$logEntity
->
setFileId
(
$file
->
getId
(
)
)
;
$logEntity
->
setRecords
(
0
)
;
$logEntity
->
setConfig
(
$this
->
getConfig
(
$profile
,
$config
)
)
;
$contextSource
=
$context
->
getSource
(
)
;
$userId
=
$contextSource
instanceof AdminApiSource ?
$contextSource
->
getUserId
(
)
: null;
if
(
$userId
!== null
)
{
$logEntity
->
setUsername
(
$this
->
findUser
(
$context
,
$userId
)
->
getUsername
(
)
)
;
$logEntity
->
setUserId
(
$userId
)
;
}
$context
->
scope
(
Context::SYSTEM_SCOPE,
function
DContext
$context
)
use
(
$logEntity
)
: void
{
$logData
=
array_filter
(
$logEntity
->
jsonSerialize
(
)
,
fn
(
$value
)
=>
$value
!== null
)
;