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

Eloquent cannot save or delete models with composite primary keys #5248

Closed
lazlo-bonin opened this issue Jul 28, 2014 · 0 comments
Closed

Eloquent cannot save or delete models with composite primary keys #5248

lazlo-bonin opened this issue Jul 28, 2014 · 0 comments

Comments

@lazlo-bonin
Copy link

When defining composite primary keys then calling save or delete on an instanced model, an exception is thrown.

Save

Type: ErrorException
Message: PDO::lastInsertId() expects parameter 1 to be string, array given
File: /vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php
Line: 32

Delete

Type: ErrorException
Message: array_key_exists(): The first argument should be either a string or an integer
File: /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php
Line: 2324

I suspect Eloquent is expecting a string primary key, while an array is given.

@lazlo-bonin lazlo-bonin changed the title Eloquent cannot delete models with composite primary keys Eloquent cannot save or delete models with composite primary keys Jul 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants