Extract values should be also possile from objects implementing ArrayAccess.
BC break: No
New feature: Yes
If you implement own collection or you want to extract values maybe from \Nette\Database\IRow. First you have to serialize object to array then you can extract values from array.
Example:
/** @var Nette\Database\Table\ActiveRow $databaseRow */
$databaseRow = $this->repository->fetch();
$array = iterator_to_array($databaseRow); // or $databaseRow->toArray()
$id = PrimitiveTypes::extractInt($array, 'id');
should be simplified to:
/** @var Nette\Database\Table\ActiveRow $databaseRow */
$databaseRow = $this->repository->fetch();
$id = PrimitiveTypes::extractInt($databaseRow, 'id');
So exract method should look like:
final public static function extractInt(array|ArrayAccess $data, string $key): int; // PHP 8.0 syntax
Extract values should be also possile from objects implementing ArrayAccess.
BC break: No
New feature: Yes
If you implement own collection or you want to extract values maybe from \Nette\Database\IRow. First you have to serialize object to array then you can extract values from array.
Example:
should be simplified to:
So exract method should look like: