-
Notifications
You must be signed in to change notification settings - Fork 351
Fix block response for minOccurs=1 / maxOccurs=1 #7751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
$minOccurs = $metadata->getMinOccurs(); | ||
$maxOccurs = $metadata->getMaxOccurs(); | ||
|
||
if (1 === $minOccurs && 1 === $maxOccurs && \count($contentViews) > 0) { | ||
$contentViews = $contentViews[0]->getContent(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benr77 can you test if this ends in the expected result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is working correctly.
$maxOccurs = $metadata->getMaxOccurs(); | ||
|
||
if (1 === $minOccurs && 1 === $maxOccurs && \count($contentViews) > 0) { | ||
$contentViews = $contentViews[0]->getContent(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Prokyonn aren't we loosing the view
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You were right, fixed it.
1ab9c35
to
01569c4
Compare
Confirmed this is working as expected :) |
What's in this PR?
Adjusts the response of the
BlockPropertyResolver
to return the single block instead of a list whenminOccurs
andmaxOccurs
are1
.Why?
The behaviour should not be changed between Sulu 2.6 and 3.0.