After Update of Statamic to 4.8 (from 3.4.7) and Relationships to 2.1 i've encountered a problem with the relationships.
Saving an entry brings up an "undefined array key 0" error.
But only on first saving. If i saved it a second time, the error is gone.
I dived into the code and found out that in "Processors/Concerns/ProcessManyToOne.php" and "Processors/Concerns/ProcessOneToOne.php" it tries to get array key 0. But in fact, this "Key" is unique (as set in "ComparisonResult.php"), so it could be 4 or 5 and so on.
I've fixed it for me, but for another update, it would be nice to be fixed in your addon.
That's what fixed it for me:
Replace both occurencies of $results->added[0]) with $results->added[array_key_first($results->added)])
because count must be 1, you can simply check for array_key_first.
After Update of Statamic to 4.8 (from 3.4.7) and Relationships to 2.1 i've encountered a problem with the relationships. Saving an entry brings up an
"undefined array key 0"
error. But only on first saving. If i saved it a second time, the error is gone. I dived into the code and found out that in "Processors/Concerns/ProcessManyToOne.php" and "Processors/Concerns/ProcessOneToOne.php" it tries to get array key 0. But in fact, this "Key" is unique (as set in "ComparisonResult.php"), so it could be 4 or 5 and so on. I've fixed it for me, but for another update, it would be nice to be fixed in your addon. That's what fixed it for me: Replace both occurencies of$results->added[0])
with$results->added[array_key_first($results->added)])
because count must be 1, you can simply check for array_key_first.