Skip to content
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

Merged

Conversation

VincentLanglet
Copy link
Member

@VincentLanglet VincentLanglet commented Jul 19, 2022

Subject

I am targeting this branch, because {reason}.

Closes #{put_issue_number_here}.

Changelog

### Added
- BlockInterface::addChild()
- BlockInterface::hasChild()

### Changed
- BlockInterface::getChildren() now returns iterable

### Deprecated
- BlockInterface::addChildren()
- BlockInterface::hasChildren()

* @var BlockInterface[]
* NEXT_MAJOR: Restrict typehint to Collection.
*
* @var Collection<int, BlockInterface>|array<BlockInterface>
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

/**
* NEXT_MAJOR: Remove this method.
Copy link
Member

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?

Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants