Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
UpdatedByValueNotFoundException example
'products_with_invalid_update_by.csv',
$clonedPropertyProfile
->
getId
(
)
)
;
static
::
assertImportExportFailed
(
$progress
)
;
$invalid
=
$this
->
getInvalidLogContent
(
$progress
->
getInvalidRecordsLogId
(
)
)
;
static
::
assertGreaterThanOrEqual
(
1, \
count
(
$invalid
)
)
;
$first
=
$invalid
[
0
]
;
static
::
assertStringContainsString
(
(
new
UpdatedByValueNotFoundException
(
ProductManufacturerDefinition::ENTITY_NAME, 'link'
)
)
->
getMessage
(
)
,
$first
[
'_error'
]
)
;
}
/** * @return array<string, mixed> */
private
function
createCategoryProfileMock
(
)
: array
{
return
[
'id' => Uuid::
randomHex
(
)
,
if
(
$idFields
->
count
(
)
!== 1 || !
$idField
)
{
return
$record
;
}
$primaryKeyProperty
=
$idField
->
getPropertyName
(
)
;
$updateByFieldPath
=
explode
(
'.',
$updateByField
)
;
$record
= \
is_array
(
$record
)
?
$record
:
iterator_to_array
(
$record
)
;
$updateByValue
=
$this
->
getValueFromPath
(
$record
,
$updateByFieldPath
)
;
if
(
$updateByValue
=== null
)
{
$record
[
'_error'
]
=
new
UpdatedByValueNotFoundException
(
$definition
->
getEntityName
(
)
,
$updateByField
)
;
return
$record
;
}
$criteria
=
new
Criteria
(
)
;
$criteria
->
setLimit
(
1
)
;
$updateByField
=
$this
->
handleTranslationsAssociation
(
$definition
,
$updateByFieldPath
,
$criteria
)
;