Relationship Resolution

Relationships are automatically resolved for you. You can query related entries like this:

$url = Prismic::getByID('WAjgAygABN3B0a-a')
    ->author
    ->headshot
    ->main
    ->getUrl()

Compare this to the same request made using the official Prismic PHP Kit.

It could be argued that this isn't a 100% fair comparison, because you could write a Link Resolver to handle the logic below. In fact, this Fluent Wrapper uses somthing like a Link Resolver behind the scenes. Since no auto resolving link resolver is provided out of the box with the official Prismic PHP Kit, I still think this is a valid example.

$document = $client->getByID('WAjgAygABN3B0a-a');
$authorId = $document->getLink('post.author')->getId();
$author = $client->getByID($authorId);
$headshotImageId = $document->getLink('author.headshot')->getId();
$headshotImage = $client->getByID($headshotImageId);
$url = $headshotImage->getView('main')->getUrl():

results matching ""

    No results matching ""