Links final readonly class
Minn\Content\Links · public/minn/src/Minn/Content/Links.php · 102 lines
The links manager's table, as get_bookmarks and wp_insert_link read and write it (probe plugin-queue4). A query narrows by the ids included (which set aside every other narrowing), the ids excluded, the link categories (joined, so a link filed under two of them comes back twice, with the join's columns), visibility and a search over the address, name and description; it sorts by one or more of the link's columns (name when none is known), ascending unless told otherwise.
Constants and properties
| const | FIELDS = array ( 0 => 'link_id', 1 => 'link_url', 2 => 'link_name', 3 => 'link_image', 4 => 'link_target', 5 => 'link_description', 6 => 'link_visible', 7 => 'link_owner', 8 => 'link_rating', 9 => 'link_updated', 10 => 'link_rel', 11 => 'link_notes', 12 => 'link_rss', ) | The columns a link row holds, in the table's order. |
| private | ORDERS = array ( 'name' => 'link_name', 'url' => 'link_url', 'rating' => 'link_rating', 'id' => 'link_id', 'owner' => 'link_owner', 'visible' => 'link_visible', 'updated' => 'link_updated', 'notes' => 'link_notes', 'description' => 'link_description', 'rel' => 'link_rel', 'target' => 'link_target', 'image' => 'link_image', 'rss' => 'link_rss', 'length' => 'length', 'rand' => 'RAND()', ) | |
| private | readonly Minn\Db $db | Promoted from the constructor. |
Public
| new | __construct(Minn\Db $db)# | ||||||||||
| method | find(int $id): ?array# | A link's row, its values as strings the way the reference reads them. @return array<string, mixed>|null @return array<string, mixed>|null | |||||||||
| method | matching(array $args, array $categories, int $recentMinutes): array# | The links a get_bookmarks call asks for.
@return list<array<string, mixed>> | |||||||||
| method | save(int $id, array $fields): int# | A link written: a new row when the id is 0, else that row's columns set. The id it was written under.
| |||||||||
| method | delete(int $id): void# | A link's row removed. |
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
Nothing matches.