Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught RuntimeException: Missing "{$keyName}" for "{$className}" #31

Closed
dragonfire1119 opened this issue Feb 24, 2017 · 4 comments
Closed
Assignees
Labels

Comments

@dragonfire1119
Copy link

dragonfire1119 commented Feb 24, 2017

I'm getting this error Uncaught RuntimeException: Missing "{$keyName}" for "{$className}" ever since I updated with composer.

My composer version: ^2.1
Tried 3.0.1

@MarcinOrlowski
Copy link
Owner

MarcinOrlowski commented Feb 24, 2017

Not sure why you closed this - it's a bug in the getClassesMapping().

Quick solution is to check you config as "classes" mapping lacks either key or method entry for class. If you are upgrading from pre 3.0.0 dev code, then you need to ensure it looks like:

'classes' => [

	Illuminate\Database\Eloquent\Model::class => [
		'key'    => 'item',
		'method' => 'toArray',
	],
	Illuminate\Database\Eloquent\Collection::class => [
		'key'    => 'items',
		'method' => 'toArray',
	],
],

@MarcinOrlowski
Copy link
Owner

Fixed in 3.0.2

@dragonfire1119
Copy link
Author

dragonfire1119 commented Feb 24, 2017

@MarcinOrlowski I closed it because I looked at the github config & copied the

Illuminate\Database\Eloquent\Model::class => [
		'key'    => 'item',
		'method' => 'toArray',
	],
	Illuminate\Database\Eloquent\Collection::class => [
		'key'    => 'items',
		'method' => 'toArray',
	],

It started working again on the 3.0 so I didn't want to waste your time.

@MarcinOrlowski
Copy link
Owner

My point is that if your report the issue then even you worked it around on your side, you should let the ticket opened for me to investigate. And even if you'd find that it was your fault then you should rather state this in comment and let the maintainer do the rest. Anyway, this time it was my bug, so thanks for the report :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants