Heroyt / tournament-generator

A set of classes used to create multiple kinds of tournament brackets in PHP
MIT License
60 stars 15 forks source link

Got such error using tournament template #2

Closed s-malinowski closed 2 years ago

s-malinowski commented 2 years ago

Fatal error: Nesting level too deep - recursive dependency? in \vendor\heroyt\tournament-generator\src\TournamentGenerator\Tournament.php on line 163

Heroyt commented 2 years ago

@Kapustaa Can you please provide your code example to replicate this issue?

s-malinowski commented 2 years ago

`<?php require 'vendor/autoload.php';

// Create a tournament $tournament = new TournamentGenerator\Preset\SingleElimination('Tournament name');

// Set tournament lengths - could be omitted $tournament ->setPlay(7) // SET GAME TIME TO 7 MINUTES ->setGameWait(2) // SET TIME BETWEEN GAMES TO 2 MINUTES ->setRoundWait(0); // SET TIME BETWEEN ROUNDS TO 0 MINUTES

// CREATE 6 TEAMS for ($i = 1; $i <= 6; $i++) { $tournament->team('Team ' . $i); }

// GENERATE ALL GAMES $tournament->generate();

// Simulate games $tournament->genGamesSimulate(); // Simulate only games for example to only save bracket to DB $tournament->genGamesSimulateReal(); // Simulate games with results like a real tournament

// GET ALL TEAMS $teams = $tournament->getTeams(true); // TRUE to get teams ordered by their results`

Heroyt commented 2 years ago

I have tried this example, but I cannot replicate this error. Is there something else you do with it? What version of the library / PHP are you using?

s-malinowski commented 2 years ago

Got php 7.3.31

Heroyt commented 2 years ago

That version is no longer supported. I would recommend for you to upgrade to at least PHP 7.4 and download the latest version of the library.

s-malinowski commented 2 years ago

It's working now, thanks