This project was developed using the provided Symfony template.
- Tailwind CSS:
php bin/console tailwind:build -w
- Clone the Repository:
git clone https://github.com/isaiasxavier/dutch-soccer-league.git
This Symfony application fetches and stores data from an external API into a relational database.
- Migration:
php bin/console doctrine:migrations:migrate
- FetchDataCommand: Fetches data from the API and populates the database.:
php bin/console FetchDataCommand
-
getTeams(): array
Retrieves a list of teams from theDED
competition. -
getMatchesDed(): array
Retrieves a list of matches from theDED
competition. -
getStanding(): array
Retrieves the standings for theDED
competition.
- getPaginationParameters(Request $request): array
Extracts pagination parameters (limit
andoffset
) from the request query, with default values of 10 and 0 respectively.
/
: Displays the homepage with current season, competition, standings, and team standings.
/register
: Displays the registration form, processes user registration, hashes the password, and logs in the user.
/login
: Shows the login form and handles authentication errors./logout
: Logs out the user (intercepted by Symfony's security)./redirect-logout
: Redirects to the logout route.
/dashboard
: Displays the dashboard with paginated teams and user-specific data.
/follow/{id}
: Allows the user to follow a team. Displays follow errors and followed teams./followed-teams
: Lists all teams followed by the user./unfollow/{id}
: Unfollows a team and redirects to the list of followed teams.
- Attributes:
id
firstName
lastName
date
nationality
contractStart
contractUntil
- Relationships:
team
(One-to-One withTeam
)
- Attributes:
id
name
code
type
emblem
- Attributes:
id
status
matchday
stage
lastUpdated
homeTeamId
awayTeamId
homeTeamScoreFullTime
awayTeamScoreFullTime
homeTeamScoreHalfTime
awayTeamScoreHalfTime
scoreWinner
scoreDuration
refereeId
refereeName
dateGame
- Relationships:
homeTeam
(Many-to-One withTeam
)awayTeam
(Many-to-One withTeam
)
- Attributes:
id
name
position
date
nationality
- Relationships:
team
(Many-to-One withTeam
)
- Attributes:
id
startDate
endDate
currentMatchday
winner
- Relationships:
competition
(Many-to-One withCompetition
)
- Attributes:
stage
type
groupName
- Relationships:
season
(Many-to-One withSeason
)
- Attributes:
position
playedGames
form
won
draw
lost
points
goalsFor
goalsAgainst
goalDifference
- Relationships:
standing
(Many-to-One withStanding
)team
(Many-to-One withTeam
)
- Attributes:
id
email
roles
password
- Attributes:
id
- Relationships:
user
(Many-to-One withUser
)team
(Many-to-One withTeam
)
- findCoachByTeamId($teamId): ?Coach
Retrieves aCoach
entity associated with a specified team ID.
- findByName(string $name): ?Competition
Retrieves aCompetition
entity by its name.
-
getFollowedTeamIds($user): array
Retrieves the IDs of all teams followed by a given user. -
getFollowedTeamsByUser($user): array
Retrieves all teams followed by a given user. -
followTeamAction($user, $team): array
Allows a user to follow a team. Validates and persists the follow action. -
unfollowTeam($user, $teamId): void
Allows a user to unfollow a team based on the team ID.
-
countMatchesByTeamId($teamId): int
Counts the number of matches involving the specified team, either as home or away. -
findMatchesByTeamId($teamId, $limit, $offset): array
Retrieves a paginated list of matches involving the specified team, either as home or away.
- findPlayerByTeamId($teamId): array
Retrieves all players associated with the specified team.
- findCurrentSeasonByCompetition(Competition $competition): ?Season
Retrieves the current season associated with the given competition.
- findByStandings(array $standings): array
RetrievesSeasonTeamStanding
entities associated with the given list of standings. - getTeamStatistics(int $teamId): array Retrieves statistical data for a specific team based on its ID, including position, points, played games, wins, draws, losses, goals for, goals against, and goal difference
-
findTeamById($id): ?Team
Retrieves aTeam
entity by its ID. -
findTeamsByIds(array $ids): array
RetrievesTeam
entities by their IDs. -
findTeamsWithPaginationAndCountAndFollowers(Request $request, $user): array
RetrievesTeam
entities with pagination, total count, and a list of followed team IDs by the given user.
-
upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void
Upgrades (rehashes) the password of a user. -
findUserByEmail(string $email): ?User
Retrieves aUser
entity by email address.
-
buildForm(FormBuilderInterface $builder, array $options): void
Configures the form fields for user registration, including email, terms agreement, and password with validation constraints. -
configureOptions(OptionsResolver $resolver): void
Sets default options for the form, specifying that the data class isUser
.
- load(ObjectManager $manager): void
Populates the database with initial user data for testing or development, including creating and persisting user entities.
-
authenticate(Request $request): Passport
Retrieves email and password from the request, creates a Passport object for user authentication, including CSRF protection. -
onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
Redirects to the originally requested page or to the dashboard upon successful authentication. -
getLoginUrl(Request $request): string
Returns the URL to the login page.
- validate($value, Constraint $constraint): void
Validates aFollow
entity to ensure that both theuser
andteam
properties are not null, adding violations if any are missing.
- Purpose: Template file for rendering the user dashboard view.
- Features: Displays user-specific data such as recent activities, notifications, and other relevant information.
- Purpose: Template file for rendering the view of followed teams for the user.
- Features: Displays a list of teams that the user is following, including team name, emblem, and links for viewing details or unfollowing.
- Purpose: Template file for rendering the homepage view, specifically displaying the standings of teams in a football competition.
- Features: Shows the competition name, season years, and competition emblem prominently at the top of the page. Displays team standings, including their position, name, emblem, and points in a table format.
- Purpose: Template file for rendering the user registration form.
- Features:
- Displays a user-friendly registration form with fields for email, password, and agreement to terms.
- Utilizes Symfony's form_row to render form fields with Tailwind CSS classes for consistent styling.
- Includes error handling to display validation errors prominently above the form fields.
- Purpose: Template file for rendering the user login form.
- Features:
- Displays a login form with fields for email and password.
- Shows error messages if the login attempt fails.
- Includes a condition to inform the user if they are already logged in.
- Purpose: This template displays detailed information about a football team, including the team's name, logo, founding date, address, website, club colors, and venue. It also provides details on the coach, squad, and recent or upcoming matches.
- Features:
- Organized Layout: Divided into sections for team details, coach and squad information, and match listings.
- Paginated Navigation: Includes "Previous" and "Next" buttons for paginated match viewing.
- Availability Check: Shows a message if team information is not available.
- Interactive Elements: Styled links for the team's website and pagination controls enhance user interaction.