A mapper to deserialize this from the query */ public static function mapper(): Mapper { return new class implements Mapper { public function map(array $result): ItemAndFeed { $it = new ItemAndFeed(); $it->item = (new JsonMapper(Item::class, 'item_data'))->map($result); $it->feed = (new JsonMapper(Feed::class, 'feed_data'))->map($result); return $it; } }; } /** * Generate the `SELECT` and `FROM` clauses for the query to retrieve this item * * @return string The `SELECT` and `FROM` clauses to retrieve these items */ public static function selectFrom(): string { $item = Table::ITEM; $feed = Table::FEED; return <<>'feed_id' = $feed.data->>'id' SQL; } }