-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
Allow to use collection for block childrens #1087
Allow to use collection for block childrens #1087
Conversation
* @var BlockInterface[] | ||
* NEXT_MAJOR: Restrict typehint to Collection. | ||
* | ||
* @var Collection<int, BlockInterface>|array<BlockInterface> |
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.
what is the advantage over iterable?
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.
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.
so array<BlockInterface>
would be fine then? 🤔
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.
The goal is to allow PageBundle to use Collection, https://github.com/sonata-project/SonataPageBundle/blob/4.x/src/Entity/BaseBlock.php#L34
See sonata-project/SonataPageBundle#1442 or sonata-project/SonataPageBundle#1469 (comment)
} | ||
|
||
/** | ||
* NEXT_MAJOR: Remove this method. |
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.
do we use addChild on page bundle?
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.
No.
In the same way we have addChildren
method in the PageInterface of PageBundle https://github.com/sonata-project/SonataPageBundle/blob/fed26c06856de8d6b1161d0f23001db7b8377e2b/src/Model/PageInterface.php#L189 which is not used. We could rename this to addChild
.
If you had in mind to remove the addChild method. I'm not chocked having some add/set method in the interface/class which will only be used by the user.
Subject
I am targeting this branch, because {reason}.
Closes #{put_issue_number_here}.
Changelog