WellCommerce\Bundle\AdminBundle\Provider\AdminMenuProvider::filterElements PHP Method

filterElements() protected method

Filters the collection and returns only children elements for given parent element
protected filterElements ( Doctrine\Common\Collections\Collection $collection, WellCommerce\Bundle\AdminBundle\Entity\AdminMenuInterface $parent = null ) : Doctrine\Common\Collections\Collection
$collection Doctrine\Common\Collections\Collection
$parent WellCommerce\Bundle\AdminBundle\Entity\AdminMenuInterface
return Doctrine\Common\Collections\Collection
    protected function filterElements(Collection $collection, AdminMenuInterface $parent = null)
    {
        $children = $collection->filter(function (AdminMenuInterface $menuItem) use($parent) {
            return $menuItem->getParent() === $parent;
        });
        return $children;
    }