Import chain
This page is the reference for every message in the import pipeline: what it
imports, what it carries, and which child messages it dispatches. All messages
live in HansPeterOrding\EspnApiSymfonyBundle\Message\EspnSync.
Anatomy of a message
Almost every message carries the same shape:
a
reference— the ESPN$refURL of the resource to import;zero or more parent entity ids — the database ids of already-imported parents the new entity must be connected to;
an optional
importEntitiesarray — the import-control flags (Import control).
The parent ids matter: by the time a child message runs, its parent has already been persisted, so the child carries the parent’s database id (not its ESPN ref) to connect to it cheaply.
A handful of messages differ:
ImportEspnPositionsMessagecarries no reference — it is a root trigger that lists all positions and dispatches oneImportEspnPositionMessageeach.ImportEspnTeamInjuriesMessagecarries ateamIdrather than a reference — it refreshes a team’s injuries.
Root triggers
These are the two entry points for a full import. Dispatch them yourself.
Season tree
Note
ImportEspnSeasonGroupMessage is recursive: a group dispatches messages
for its child groups, walking the hierarchy until it reaches leaf groups.
The parentGroupId carries the already-persisted parent so each group is
linked to its parent.
Team tree
Message |
Constructor |
Dispatches |
|---|---|---|
|
|
Venue, Franchise, Record, Athlete, Coach, TeamInjuries |
|
|
— (leaf) |
|
|
— (leaf) |
|
|
— (leaf) |
|
|
— (leaf) |
|
|
Injury (after deleting the team’s current injuries) |
Athlete tree
Message |
Constructor |
Dispatches |
|---|---|---|
|
|
Contract, Injury |
|
|
— (leaf) |
|
|
— (leaf) |
Note
An athlete’s notes are imported inline by the athlete importer (not as a
separate message). The same is true for a team’s notes. Injuries are
connected to all season instances of the athlete sharing the same
espnId, because an injury is season-independent.
Event tree
Positions tree
Message |
Constructor |
Dispatches |
|---|---|---|
|
|
— (resolves its parent position inline) |
Dispatching mid-chain
Because every message connects to its parents through ids it carries, you can enter the chain at any point — as long as the parents it references already exist in your database. This is the basis for targeted refreshes:
use HansPeterOrding\EspnApiSymfonyBundle\Message\EspnSync\ImportEspnTeamMessage;
use HansPeterOrding\EspnApiClient\ApiClient\EspnApiClientInterface;
// Re-import a single team (the season must already be imported)
$teamRef = EspnApiClientInterface::BASE_URI_SPORTS_CORE . 'seasons/2025/teams/12';
$bus->dispatch(new ImportEspnTeamMessage($teamRef, $seasonEntityId));
If a referenced parent is not present, the importer raises an unrecoverable error rather than guessing — see Error handling.
Read next
Messenger — transports, routing, and retries
Error handling — recoverable vs. unrecoverable failures