MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

ProjectBoard

MMO\git\helpers · 1 symbole · générée le 27 Oct 2026

class

ProjectBoard

ProjectBoard.php:36

A GitHub project (Projects v2: github.com/users/<login>/projects/<n>, or orgs/<login>/...) seen as the data of a kanban board (mmo.client's <mmo-kanban>), and the changes made on the board written back to the project.

class MMO\git\helpers\ProjectBoard extends MMO\git\classes\aBoard
Espace de noms
MMO\git\helpers
Étend
aBoard
Through the GraphQL API: it needs a token that can read projects, and write them to save (README.md says which). ### What an item becomes | ticket | project item | |---------------|-------------------------------------------------------------------------------------------| | statuses | the options of the `Status` field, in the project's order | | `id` | the issue's or pull request's number; `d<n>` for a draft | | `title`, `description`, `assignee`, `labels` | the issue's, pull request's or draft's (a draft has no label) | | `status` | its `Status`; an item without one has the first | | `category` | its value of [`$categoryField`](https://mmoframework.fr/fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard-categoryfield): the project's first iteration field unless told | | `start`, `end`| its values of the date fields [`$startField`](https://mmoframework.fr/fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard-startfield) and [`$endField`](https://mmoframework.fr/fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard-endfield) | | `parent`, `constraint`, `startedAt` | a text field of the project, [`$metaField`](https://mmoframework.fr/fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard-metafield), made the first time it is needed | A status is "done" when its name says so ([`$done`](https://mmoframework.fr/fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard-done)), "not started" when it says that ([`$backlog`](https://mmoframework.fr/fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard-backlog)), started otherwise. A new ticket is a draft issue of the project. A ticket removed from the board leaves the project: its issue, if it has one, stays as it is. The issues' state is not changed: the project's own workflows close an issue whose item is done, when they are set up to. A draft becomes an issue when asked ([`toIssue`](https://mmoframework.fr/fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard-toissue)), to be commented on.
GitHubAPI::Configure(['token' => $token]); $board = ProjectBoard::FromUrl(GitHubAPI::Shared(), 'https://github.com/users/MarcMouret/projects/1'); $data = $board->load();

Index

FIELD_NAME
api
backlog
categoryField
contents
done
endField
items
metaField
number
organization
owner
project
startField
statusField
users
categories()
discussion($ticketId)
field($role)
FromUrl($api, $url) static
getState()
getTitle()
getUrl()
isGone($ticketId, $locator)Ask GitHub for the ticket's item by its node id, rather than trust the listing of the project's items: GitHub lists a draft just made minutes later (345 s, seen on 19/10/2026).
load()Read the project's items as a board's data.
locator($ticketId)
metaFieldOrCreate()
project()
save($before, $after)Write to the project what changed on the board: a new ticket is a draft, a removed one leaves the project.
setState($state)
statusType($name)
toFields($ticket, $statuses)
toIssue($ticketId, $repository)Make an issue of a draft, in its place in the project: an issue has a discussion, a draft has none.
toTicket($item, $statuses)
userId($login)
write($ticket, $old, $new)Make the changes from $old to $new on the item.
__construct($api, $owner, $number, $organization)

Constantes1

FIELD_NAME

const FIELD_NAME = 'field {... on ProjectV2FieldCommon {name}}'

Propriétés15

api

protected MMO\git\GitHubAPI $api
Type
GitHubAPI

backlog

string $backlog = '/\\b(backlog|to ?do|new|triage|inbox|ready|planned|icebox)\\b/i'
Type
string

categoryField

?string $categoryField = null
Type
null | string

contents

protected array $contents = []
Type
array

done

string $done = '/\\b(done|closed|complete[d]?|shipped|released|finished)\\b/i'
Type
string

items

protected array $items = []
Type
array

metaField

string $metaField = 'mmo-kanban'
Type
string

number

protected int $number
Type
int

organization

protected bool $organization
Type
bool

owner

protected string $owner
Type
string

project

protected ?array $project = null
Type
null | array

startField

?string $startField = null
Type
null | string

statusField

string $statusField = 'Status'
Type
string

users

protected array $users = []
Type
array

Méthodes21

categories()

ProjectBoard.php:270
protected function categories(): array
retournearraythe board's categories: the options or iterations of the category field

discussion($ticketId)

ProjectBoard.php:288
function discussion(string $ticketId): ?MMO\git\helpers\IssueDiscussion
$ticketIdstring
retournenull | IssueDiscussionthe comments of its issue or pull request; null for a draft, which has none
lèvewhen the project cannot be read (it is, to know which repository the ticket's issue is in)

field($role)

ProjectBoard.php:249
protected function field(string $role): ?array
$rolestringstatus, category, start, end or meta
retournenull | arraythe project's field playing that role: {id, name, dataType, options?, configuration?}

FromUrl($api, $url)

staticProjectBoard.php:86
static function FromUrl(MMO\git\GitHubAPI $api, string $url): self
$apiGitHubAPI
$urlstringthe project's page, https://github.com/users/<login>/projects/<n> or .../orgs/...
retourneself
lèvewhen it is not a project's url
ProjectBoard::FromUrl(GitHubAPI::Shared(), 'https://github.com/orgs/acme/projects/3/views/1');

isGone($ticketId, $locator)

ProjectBoard.php:471

Ask GitHub for the ticket's item by its node id, rather than trust the listing of the project's items: GitHub lists a draft just made minutes later (345 s, seen on 19/10/2026).

function isGone(string $ticketId, ?string $locator): ?bool
$ticketIdstring
$locatornull | string
retournenull | booltrue when GitHub has no such item, or has it archived, or in another project (what load leaves out); false when the project has it; null without a locator, or when GitHub answers something else

load()

ProjectBoard.php:112

Read the project's items as a board's data.

function load(): array
retournearrayarray, labels: array, categories: array, tickets: array}
lèvewhen GitHub refuses, or there is no such project

metaFieldOrCreate()

ProjectBoard.php:506
protected function metaFieldOrCreate(): array
retournearraythe text field holding what the project has no field for, made the first time it is needed

project()

ProjectBoard.php:500
protected function project(): array
retournearraythe project as last read, read now if it was not: {id, title, url, fields}
lèvewhen it cannot be read

save($before, $after)

ProjectBoard.php:332

Write to the project what changed on the board: a new ticket is a draft, a removed one leaves the project.

function save(array $before, array $after): array
$beforearraythe board's data as load gave it: its tickets carry their item and content
$afterarraythe board's data now
retournearrayarray<string, string>, saved: array} the id each new ticket got (d<n>), by the id the board gave it; and the board as the project has it now (load's shape: its tickets with their new ids, their item and content) -- what the next save compares with: GitHub lists a draft just made some time after, so reading the project again at once could miss it, and the next save would make it twice, then remove one
lèvewhen GitHub refuses a change: the ones made before it are made

toFields($ticket, $statuses)

ProjectBoard.php:393
function toFields(array $ticket, array $statuses): array
$ticketarray
$statusesarraythe board's
retournearraythe values the ticket gives its item, compared by save to know what changed

toIssue($ticketId, $repository)

ProjectBoard.php:303

Make an issue of a draft, in its place in the project: an issue has a discussion, a draft has none. Its title, text and assignees go with it, its fields stay the item's.

function toIssue(string $ticketId, string $repository): string
$ticketIdstringthe draft's (d<n>)
$repositorystringowner/name, the issue's
retournestringthe ticket's id now: the issue's number (a ticket already an issue keeps its own)
lèvewhen the project has no such ticket, GitHub refuses (the token cannot write the repository's issues), or there is no such repository

toTicket($item, $statuses)

ProjectBoard.php:212
function toTicket(array $item, array $statuses): array
$itemarrayas the GraphQL query of load gives it
$statusesarraythe board's
retournearraythe ticket. Beyond the board's fields, it carries what saving needs: item (the item's node id), content (the draft's node id, or the issue's {repository, number}) and url

userId($login)

ProjectBoard.php:518
protected function userId(string $login): string
$loginstring
retournestringthe user's node id, which a draft's assignees are given as

__construct($api, $owner, $number, $organization)

ProjectBoard.php:76
function __construct( MMO\git\GitHubAPI $api, string $owner, int $number, bool $organization = false )
$apiGitHubAPI
$ownerstringthe login owning the project
$numberintthe project's number, in its url
$organization = falseboolwhether the owner is an organization rather than a user
Membres hérités (7)
ConstantesDéclaré parDescription
COLORSaBoardthe colours mmo-kanban names, as GitHub's label colours: a colour read from GitHub is named when it is one
MéthodesDéclaré parDescription
ColorHex($color)aBoard
ColorName($color)aBoard
keepsColor($kind)aBoard
meta($ticket, $type)aBoard
remap($ticket, $ids, $categories)aBoardGive the board's ids of new tickets and categories the ones GitHub gave them.
remapCondition($node, $ids)aBoard