Strict standards: Only variables should be passed by reference in C:\xampp\htdoc s\EliteFifa2\src\EliteFifa\Bundle\DataFixtures\ORM\MatchFixtures.php on line 70
Line 70 is referring to this line:
$lastHomeTeam = array_shift(array_splice($homeTeams, 1, 1));
I don't understand what is going wrong because the following algorithm works in a normal PHP page.
class MatchFixtures extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
{
private $container;
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
public function load(ObjectManager $manager)
{
$teams = array(0, 1, 2, 3);
$worldSeason1 = $this->getReference("WorldSeason1");
$league1 = $this->getReference("League 1");
$fixtures = $this->createFixtures($teams, $worldSeason1, $league1);
}
private function createFixtures($teams, $season, $competition)
{
$teamsCount = count($teams);
$rounds = $teamsCount - 1;
$matchesPerRound = $teamsCount / 2;
$awayTeams = array_splice($teams, $matchesPerRound);
$homeTeams = $teams;
$fixtures = array();
for ($r = 0; $r < $rounds; $r++) {
for ($m = 0; $m < $matchesPerRound; $m++) {
$homeTeam = $homeTeams[$m];
$awayTeam = $awayTeams[$m];
$fixtures[$r][$m]["home"] = $homeTeam;
$fixtures[$r][$m]["away"] = $awayTeam;
}
$lastHomeTeam = array_shift(array_splice($homeTeams, 1, 1));
array_unshift($awayTeams, $lastHomeTeam);
$lastAwayTeam = array_pop($awayTeams);
array_push($homeTeams, $lastAwayTeam);
}
return $fixtures;
}
}