$row - Single car model row from database */ public function map(array $row): CarModel { $carModelId = is_string($row['id'] ?? null) ? $row['id'] : throw new \InvalidArgumentException('CarModel ID is required'); $brandId = is_string($row['brand_id'] ?? null) ? $row['brand_id'] : throw new \InvalidArgumentException('Brand ID is required'); return new CarModel( carModelId: new CarModelId($carModelId), brandId: new BrandId($brandId), name: is_string($row['name'] ?? null) ? $row['name'] : throw new \InvalidArgumentException('CarModel name is required'), ); } }