Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
handleAllConstraint example
$scalar
= false;
}
if
(
!
$nullable
&&
$type
->
isNullable
(
)
)
{
$nullable
= true;
}
}
if
(
!
$hasTypeConstraint
)
{
if
(
1 === \
count
(
$builtinTypes
)
)
{
if
(
$types
[
0
]
->
isCollection
(
)
&& \
count
(
$collectionValueType
=
$types
[
0
]
->
getCollectionValueTypes
(
)
)
> 0
)
{
[
$collectionValueType
]
=
$collectionValueType
;
$this
->
handleAllConstraint
(
$property
,
$allConstraint
,
$collectionValueType
,
$metadata
)
;
}
$metadata
->
addPropertyConstraint
(
$property
,
$this
->
getTypeConstraint
(
$builtinTypes
[
0
]
,
$types
[
0
]
)
)
;
}
elseif
(
$scalar
)
{
$metadata
->
addPropertyConstraint
(
$property
,
new
Type
(
[
'type' => 'scalar'
]
)
)
;
}
}
if
(
!
$nullable
&& !
$hasNotBlankConstraint
&& !
$hasNotNullConstraint
)
{
$metadata
->
addPropertyConstraint
(
$property
,
new
NotNull
(
)
)
;
}
}
$scalar
= false;
}
if
(
!
$nullable
&&
$type
->
isNullable
(
)
)
{
$nullable
= true;
}
}
if
(
!
$hasTypeConstraint
)
{
if
(
1 === \
count
(
$builtinTypes
)
)
{
if
(
$types
[
0
]
->
isCollection
(
)
&& \
count
(
$collectionValueType
=
$types
[
0
]
->
getCollectionValueTypes
(
)
)
> 0
)
{
[
$collectionValueType
]
=
$collectionValueType
;
$this
->
handleAllConstraint
(
$property
,
$allConstraint
,
$collectionValueType
,
$metadata
)
;
}
$metadata
->
addPropertyConstraint
(
$property
,
$this
->
getTypeConstraint
(
$builtinTypes
[
0
]
,
$types
[
0
]
)
)
;
}
elseif
(
$scalar
)
{
$metadata
->
addPropertyConstraint
(
$property
,
new
Type
(
[
'type' => 'scalar'
]
)
)
;
}
}
if
(
!
$nullable
&& !
$hasNotBlankConstraint
&& !
$hasNotNullConstraint
)
{
$metadata
->
addPropertyConstraint
(
$property
,
new
NotNull
(
)
)
;
}
}