Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
CanNotFindParentStorageFieldException example
if
(
!
$parent
)
{
throw
new
ParentFieldNotFoundException
(
$definition
)
;
}
if
(
!
$parent
instanceof ManyToOneAssociationField
)
{
throw
new
InvalidParentAssociationException
(
$definition
,
$parent
)
;
}
$fk
=
$definition
->
getFields
(
)
->
getByStorageName
(
$parent
->
getStorageName
(
)
)
;
if
(
!
$fk
)
{
throw
new
CanNotFindParentStorageFieldException
(
$definition
)
;
}
if
(
!
$fk
instanceof FkField
)
{
throw
new
ParentFieldForeignKeyConstraintMissingException
(
$definition
,
$fk
)
;
}
return
$fk
;
}
/** * @param array<string, string> $primaryKey * * @return array<string, mixed> */
if
(
!
$parent
)
{
throw
new
ParentFieldNotFoundException
(
$definition
)
;
}
if
(
!
$parent
instanceof ManyToOneAssociationField
)
{
throw
new
InvalidParentAssociationException
(
$definition
,
$parent
)
;
}
$fk
=
$definition
->
getFields
(
)
->
getByStorageName
(
$parent
->
getStorageName
(
)
)
;
if
(
!
$fk
)
{
throw
new
CanNotFindParentStorageFieldException
(
$definition
)
;
}
if
(
!
$fk
instanceof FkField
)
{
throw
new
ParentFieldForeignKeyConstraintMissingException
(
$definition
,
$fk
)
;
}
return
$fk
;
}
/** * @param array<Field> $fields * * @return array<string, mixed> */