Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
PropertyInfoLoaderEntity example
;
$propertyInfoLoader
=
new
PropertyInfoLoader
(
$propertyInfoStub
,
$propertyInfoStub
,
$propertyInfoStub
, '{.*}'
)
;
$validator
= Validation::
createValidatorBuilder
(
)
->
enableAttributeMapping
(
)
->
addLoader
(
$propertyInfoLoader
)
->
getValidator
(
)
;
$classMetadata
=
$validator
->
getMetadataFor
(
new
PropertyInfoLoaderEntity
(
)
)
;
$nullableStringMetadata
=
$classMetadata
->
getPropertyMetadata
(
'nullableString'
)
;
$this
->
assertCount
(
1,
$nullableStringMetadata
)
;
$nullableStringConstraints
=
$nullableStringMetadata
[
0
]
->
getConstraints
(
)
;
$this
->
assertCount
(
1,
$nullableStringConstraints
)
;
$this
->
assertInstanceOf
(
TypeConstraint::
class
,
$nullableStringConstraints
[
0
]
)
;
$this
->
assertSame
(
'string',
$nullableStringConstraints
[
0
]
->type
)
;
$stringMetadata
=
$classMetadata
->
getPropertyMetadata
(
'string'
)
;
$this
->
assertCount
(
1,
$stringMetadata
)
;
$stringConstraints
=
$stringMetadata
[
0
]
->
getConstraints
(
)
;