BoardSync
MMO\git\helpers · 1 symbol · generated 5 Oct 2026
BoardSync
BoardSync.php:41Merge two repositories of mmo.client's kanban entities (KanbanBoard, KanbanTicket, KanbanComment) into each other, when asked: a local one -- a JsonRepository, mmo.mongodb's MongoRepository -- where the tickets are worked on, and a remote one, usually a GitHubRepository (a GitHub project, or a repository's issues). Each side keeps its own ids; a sync writes on each side what the other changed since the last one.
- Namespace
MMO\git\helpers- See
$match(the same title, by default) before any is made. - A ticket removed on one side is removed on the other, unless the other changed it since (a conflict), or,$deletionsis false. - The statuses are paired by$statuses, else by their label, else by their id, else by their type; the categories and the labels by their label. A parent, or a ticket a constraint names, is the paired ticket. - The comments are merged the same way, ticket by ticket, when the remote ticket has a discussion (a project's draft has none: its comments stay local). A comment made on GitHub says who wrote it locally when it is not the token's owner; only the token's owner's comments are changed or removed there. - What one side cannot keep (a draft's labels) is not a change: the remote side is read again after it is written, and what it kept is what the next sync compares with.
Index
| DEFAULT_STATUSES | a board without statuses has <mmo-kanban>'s | |
| FIELDS | a ticket's fields that are merged: the kanban's names | |
| LOCAL | the side a conflict is settled for, or neither | |
| REFERENCES | the fields naming other tickets: written once the tickets they name are on both sides | |
| REMOTE | ||
| SKIP | ||
| conflicts | ||
| deletions | ||
| local | ||
| localBoard | ||
| maps | ||
| match | ||
| matchId | ||
| remote | ||
| remoteBoard | ||
| report | ||
| state | ||
| stateFile | ||
| statuses | ||
| attribute($comment, $viewer) | ||
| board($side) | ||
| boards($dryRun) | a side without the board gets it, with the other's settings | |
| buildMaps() | ||
| collection($side, $class) | ||
| comments($side, $ticket) | ||
| data($ticket) | ||
| discusses($remoteTicket) | ||
| discussions() | merge the comments of each pair of tickets whose remote one has a discussion | |
| explicitRemoteIds($remoteStatuses) | ||
| merge($created, $dryRun) | Merge the fields of each pair: what changed on one side since the last sync is written on the other. | |
| mergeComments($l, $r, $local, $remote, $viewer) | ||
| name($side) | ||
| other($side) | ||
| pairAndCreate($dryRun) | Pair the tickets, make on each side those it lacks, and remove those removed on the other. | |
| pairList($from, $to, $explicit, $byType) | ||
| readState() | ||
| reload() | read the remote side again: what it kept of what was written, and the ids it gave | |
| removeTicket($side, $ticket) | remove a ticket and the comments its side holds already | |
| run($dryRun) | Merge the two boards into each other. | |
| sideReport() | ||
| tickets($side) | ||
| translate($data, $from, $only) | ||
| translateCondition($node, $pairs) | ||
| translateLabels($labels, $from) | ||
| unpair($local) | ||
| writeState() | write through a temporary file: a crash never leaves half a state | |
| __construct($local, $remote, $stateFile, $localBoard, $remoteBoard) |
Constants6
DEFAULT_STATUSES
a board without statuses has <mmo-kanban>'s
FIELDS
a ticket's fields that are merged: the kanban's names
LOCAL
the side a conflict is settled for, or neither
REFERENCES
the fields naming other tickets: written once the tickets they name are on both sides
REMOTE
SKIP
Properties13
conflicts
- Type
- string
deletions
- Type
- bool
local
- Type
- aRepository
localBoard
- Type
- string
maps
- Type
- array
match
matchId
remote
- Type
- aRepository
remoteBoard
- Type
- string
report
- Type
- array
state
- Type
- array
stateFile
- Type
- string
statuses
- Type
- array
Methods28
attribute($comment, $viewer)
BoardSync.php:556| $comment | KanbanComment | |
| $viewer | null | string | |
| returns | string | a local comment's body as it is written on the remote side: saying who wrote it, when it is not who writes there |
board($side)
BoardSync.php:147| $side | string | |
| returns | null | KanbanBoard |
boards($dryRun)
BoardSync.php:132a side without the board gets it, with the other's settings
buildMaps()
BoardSync.php:153| returns | array | array<string, ?string>> the statuses and categories of each side, by the other's ids |
collection($side, $class)
BoardSync.php:587| $side | string | |
| $class | string | |
| returns | iCollection | the side's collection of $class |
| throws | when it has none |
comments($side, $ticket)
BoardSync.php:571data($ticket)
BoardSync.php:417| $ticket | KanbanTicket | |
| returns | array | the merged fields of a ticket, as the kanban names them, the labels in order |
discusses($remoteTicket)
BoardSync.php:565discussions()
BoardSync.php:452merge the comments of each pair of tickets whose remote one has a discussion
| returns | void |
explicitRemoteIds($remoteStatuses)
BoardSync.php:171merge($created, $dryRun)
BoardSync.php:298Merge the fields of each pair: what changed on one side since the last sync is written on the other.
mergeComments($l, $r, $local, $remote, $viewer)
BoardSync.php:473name($side)
BoardSync.php:592other($side)
BoardSync.php:596pairAndCreate($dryRun)
BoardSync.php:214Pair the tickets, make on each side those it lacks, and remove those removed on the other.
pairList($from, $to, $explicit, $byType)
BoardSync.php:188readState()
BoardSync.php:611| returns | array | array<string, string>, base: array<string, array>, comments: array<string, array>} |
reload()
BoardSync.php:601read the remote side again: what it kept of what was written, and the ids it gave
| returns | void |
removeTicket($side, $ticket)
BoardSync.php:437remove a ticket and the comments its side holds already
| $side | string | |
| $ticket | KanbanTicket | |
| returns | void |
run($dryRun)
BoardSync.php:112Merge the two boards into each other.
| $dryRun = false | bool | only say what would be done |
| returns | array | {dryRun, local, remote, conflicts, notes}: what was done on each side (created, updated, removed tickets, comments), the conflicts left, and what could not be synced |
| throws | when a side refuses a change: what was done before is kept in the state |
sideReport()
BoardSync.php:606| returns | array | list<array>, updated: list<array>, removed: list<array>, comments: array{created: int, updated: int, removed: int}} |
tickets($side)
BoardSync.php:428translate($data, $from, $only)
BoardSync.php:377translateCondition($node, $pairs)
BoardSync.php:407translateLabels($labels, $from)
BoardSync.php:394unpair($local)
BoardSync.php:445writeState()
BoardSync.php:622write through a temporary file: a crash never leaves half a state
| returns | void |
__construct($local, $remote, $stateFile, $localBoard, $remoteBoard)
BoardSync.php:101| $local | aRepository | the repository the tickets are worked on in |
| $remote | aRepository | the one it is synced with: a GitHubRepository, or any repository of kanban entities |
| $stateFile | string | a JSON file keeping what both sides held at the end of the last sync ({root} and the like are expanded): the pairs of tickets and comments, and their fields. Lost, the next sync pairs the tickets by $match again, and settles every difference as a conflict. |
| $localBoard = 'main' | string | the name of the local board |
| $remoteBoard = null | null | string | the name of the remote one; null: a GitHubRepository's board, else $localBoard |