protected function sortChannels(ArrayCollection $channels)
    {
        $channels->map(function ($channel) {
            $channel->setChildren($this->sortChannels($channel->getChildren()));
        });

        $iterator = $channels->getIterator();
        $iterator->uasort(function ($a, $b) {
            return $a->getName() > $b->getName();
        });

        return new ArrayCollection(iterator_to_array($iterator));
    }
protected function sortChannels(ArrayCollection $channels)
    {
        $channels->map(function ($channel) {
            $channel->setChildren($this->sortChannels($channel->getChildren()));
        });

        $iterator = $channels->getIterator();
        $iterator->uasort(function ($a, $b) {
            return $a->getName() > $b->getName();
        });

        return new ArrayCollection(iterator_to_array($iterator));
    }
protected function sortChannels ( ArrayCollection $ channels ) { $ channels -> map ( function ( $ channel ) { $ channel -> setChildren ( $ this -> sortChannels ( $ channel -> getChildren ( ) ) ) ; } ) ; $ iterator = $ channels -> getIterator ( ) ; $ iterator -> uasort ( function ( $ a , $ b ) { return $ a -> getName ( ) > $ b -> getName ( ) ; } ) ; return new ArrayCollection ( iterator_to_array ( $ iterator ) ) ; }
Since the VMPro API doesn't sort any more the returned channels, we have to do it on our side.

@param ArrayCollection $channels

@return ArrayCollection
Since the VMPro API doesn t sort any more the returned channels we have to do it on our side .