PostRecord final readonly class
Minn\Content\PostRecord · public/minn/src/Minn/Content/PostRecord.php · 156 lines · implements ArrayAccess
One row of the posts table, read by name. The columns keep their WordPress spelling on the way in (row()) and get plain names here: $post->title, $post->slug, $post->status. A record is built from a row and can hand the row back, so a writer or a REST shaper that still works in columns is not disturbed.
Array access is the migration bridge: code that still reads $post['post_title'] keeps working while it is moved over. New code reads the properties. The style suite counts the bracket reads down.
Used by 43 (show)
Constants and properties
| prop | readonly int $id | Promoted from the constructor. |
| prop | readonly int $authorId | Promoted from the constructor. |
| prop | readonly string $date | Promoted from the constructor. |
| prop | readonly string $dateGmt | Promoted from the constructor. |
| prop | readonly string $content | Promoted from the constructor. |
| prop | readonly string $title | Promoted from the constructor. |
| prop | readonly string $excerpt | Promoted from the constructor. |
| prop | readonly string $status | Promoted from the constructor. |
| prop | readonly string $commentStatus | Promoted from the constructor. |
| prop | readonly string $pingStatus | Promoted from the constructor. |
| prop | readonly string $password | Promoted from the constructor. |
| prop | readonly string $slug | Promoted from the constructor. |
| prop | readonly string $modified | Promoted from the constructor. |
| prop | readonly string $modifiedGmt | Promoted from the constructor. |
| prop | readonly int $parentId | Promoted from the constructor. |
| prop | readonly string $guid | Promoted from the constructor. |
| prop | readonly int $menuOrder | Promoted from the constructor. |
| prop | readonly string $type | Promoted from the constructor. |
| prop | readonly string $mimeType | Promoted from the constructor. |
| prop | readonly int $commentCount | Promoted from the constructor. |
| private | readonly array $row | Promoted from the constructor. |
Public
| new | __construct(int $id, int $authorId, string $date, string $dateGmt, string $content, string $title, string $excerpt, string $status, string $commentStatus, string $pingStatus, string $password, string $slug, string $modified, string $modifiedGmt, int $parentId, string $guid, int $menuOrder, string $type, string $mimeType, int $commentCount, array $row)# |
| |||
| static | fromRow(array $row): self# | A record from a posts row; a missing column reads as empty.
| |||
| static | fromRows(array $rows): array# | A record for every row, in order.
| |||
| method | row(): array# | The stored row, for the writers and shapers that still spell columns. The row as the table holds it, joined columns and all. | |||
| method | status(): ?Minn\Content\PostStatus# | The status as an enum case, or null for a status only a plugin knows. | |||
| method | isPublished(): bool# | Published, and so public. | |||
| method | isLive(): bool# | Publish, future or private: it counts, it links, it is not a draft. | |||
| method | isTrashed(): bool# | In the trash. | |||
| method | isProtected(): bool# | Behind a password. | |||
| method | isPage(): bool# | A page. | |||
| method | isAttachment(): bool# | An attachment. | |||
| method | column(string $name): mixed# | One stored column by its database name, or null. A joined column, or any column by its table name. | |||
| method | offsetExists(mixed $offset): bool# | The migration bridge: the record answers to its column names the way the row did. | |||
| method | offsetGet(mixed $offset): mixed# | The migration bridge: one column by its stored name, or null. | |||
| method | offsetSet(mixed $offset, mixed $value): never# | Records are read-only; writes go through the repository. | |||
| method | offsetUnset(mixed $offset): never# | Records are read-only; writes go through the repository. |
Nothing matches.