Shuffle Symfony entities
You don't need a temporary variable $tempEntries
You don't need to check if the array is empty, if the array is empty shuffle will just do nothing


The code you need may look like:

$entries = $contest-&gt;getEntries();
shuffle($entries);