Description
Describe the bug
When using the Notion::database() method to retrieve pages in a database, a HandlingException is thrown if it encounters a Rollup that refers to a Select, and that Select is empty.
The exception is thrown inside FiveamCode\LaravelNotionApi\Entities\Properties\Select::fillFromRaw(). Exception message:
"The property-type is select, however the raw data-structure does not reprecent this type. Please check the raw response-data."
To Reproduce
Laravel 8.60, OS MacOS 11.6 (Bug Sur), PHP 8.0.14.
- Create 2 databases in Notion, DB1 and DB2.
- In DB1, create a Select property titled "Select". Enter a couple of options.
- In DB2, create a Relation to DB1. Call it "Relation".
- In DB2, create a Rollup that uses the relation to DB1, and its Select property. Call it "Rollup".
- Create a row in DB1 but leave the Select empty. Title it "A".
- Create a row in DB2, Title it "X", and select "A" in its Relation property.
Now use the following code to read the DB2 database:
$notion = new Notion(secret_key);
$results = $notion->database(id_for_DB2)->query();
Expected behavior
All rows from DB2 should be returned in $results. Instead, HandlingException is thrown with the message
"The property-type is select, however the raw data-structure does not reprecent this type. Please check the raw response-data."