Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isAllowCustomerWrite example
$customFieldSet
->
getConfig
(
)
)
;
static
::
assertTrue
(
$customFieldSet
->
isGlobal
(
)
)
;
$customFieldCollection
=
$customFieldSet
->
getCustomFields
(
)
;
static
::
assertInstanceOf
(
CustomFieldCollection::
class
,
$customFieldCollection
)
;
static
::
assertCount
(
2,
$customFieldCollection
)
;
$fieldWithoutAllowWrite
=
$customFieldCollection
->
filterByProperty
(
'name', 'bla_test'
)
->
first
(
)
;
static
::
assertInstanceOf
(
CustomFieldEntity::
class
,
$fieldWithoutAllowWrite
)
;
static
::
assertFalse
(
$fieldWithoutAllowWrite
->
isAllowCustomerWrite
(
)
)
;
$fieldWithAllowWrite
=
$customFieldCollection
->
filterByProperty
(
'name', 'bla_test2'
)
->
first
(
)
;
static
::
assertInstanceOf
(
CustomFieldEntity::
class
,
$fieldWithAllowWrite
)
;
static
::
assertTrue
(
$fieldWithAllowWrite
->
isAllowCustomerWrite
(
)
)
;
}
private
function
assertDefaultWebhooks
(
string
$appId
)
: void
{
/** @var EntityRepository $webhookRepository */
$webhookRepository
=
$this
->
getContainer
(
)
->
get
(
'webhook.repository'
)
;
'en-GB' => 'Custom field test',
'de-DE' => 'Zusatzfeld Test',
]
,
$customFieldSet
->
getLabel
(
)
)
;
static
::
assertEquals
(
[
'product', 'customer'
]
,
$customFieldSet
->
getRelatedEntities
(
)
)
;
static
::
assertTrue
(
$customFieldSet
->
getGlobal
(
)
)
;
static
::
assertCount
(
2,
$customFieldSet
->
getFields
(
)
)
;
$fields
=
$customFieldSet
->
getFields
(
)
;
static
::
assertSame
(
'bla_test',
$fields
[
0
]
->
getName
(
)
)
;
static
::
assertFalse
(
$fields
[
0
]
->
isAllowCustomerWrite
(
)
)
;
static
::
assertFalse
(
$fields
[
0
]
->
isAllowCartExpose
(
)
)
;
static
::
assertSame
(
'bla_test2',
$fields
[
1
]
->
getName
(
)
)
;
static
::
assertTrue
(
$fields
[
1
]
->
isAllowCustomerWrite
(
)
)
;
static
::
assertTrue
(
$fields
[
1
]
->
isAllowCartExpose
(
)
)
;
}
}
'en-GB' => 'Custom field test',
'de-DE' => 'Zusatzfeld Test',
]
,
$customFieldSet
->
getLabel
(
)
)
;
static
::
assertEquals
(
[
'product', 'customer'
]
,
$customFieldSet
->
getRelatedEntities
(
)
)
;
static
::
assertTrue
(
$customFieldSet
->
getGlobal
(
)
)
;
static
::
assertCount
(
2,
$customFieldSet
->
getFields
(
)
)
;
$fields
=
$customFieldSet
->
getFields
(
)
;
static
::
assertSame
(
'bla_test',
$fields
[
0
]
->
getName
(
)
)
;
static
::
assertFalse
(
$fields
[
0
]
->
isAllowCustomerWrite
(
)
)
;
static
::
assertFalse
(
$fields
[
0
]
->
isAllowCartExpose
(
)
)
;
static
::
assertSame
(
'bla_test2',
$fields
[
1
]
->
getName
(
)
)
;
static
::
assertTrue
(
$fields
[
1
]
->
isAllowCustomerWrite
(
)
)
;
static
::
assertTrue
(
$fields
[
1
]
->
isAllowCartExpose
(
)
)
;
}
}