-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
When you search for something, the actual type of Entity returned is quite sparse. For example:
$client = new SpotifyClient($clientId, $clientSecret);
$searchResults = $client->search->query(
new FilterQuery(
upc: $upc
),
new SearchFilter(EntityType::album),
);
/** @var SHIFT\Spotify\Entity\Album $album - this is the object we're talking about **/
$album = $searchResults->albums->items[0];
echo $album->name; // this works fine
echo $album->artists[0]->name; // there are no artists!
echo $album->label; // there is no label!To fix this, an extra call is required to "get" the full album details:
$album = $client->albums->get($searchResults->albums->items[0]->id);
// Now we can see $album->artists, $album->label, etc.This makes sense to avoid recursive large objects, but it should be indicated to the developer that this is happening.
My first idea was to return an SearchResultAlbum instead of Album, and all SearchResult types should have a method to return an inflated version of the Entity they represent.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request