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

class that has composite key produce error #416

Closed
aqualaguna opened this issue Apr 24, 2018 · 2 comments
Closed

class that has composite key produce error #416

aqualaguna opened this issue Apr 24, 2018 · 2 comments
Assignees
Labels

Comments

@aqualaguna
Copy link

Q A
Bug? yes
New Feature? yes
Framework Laravel
Framework version 5.4.y
Package version 6.0.0
PHP version 7.0.1

Actual Behaviour

i get this error actualy in my project

array_key_exists(): The first argument should be either a string or an integer
at Model->getKey()
in Auditable.php (line 250)

i implement it in my class that has composite key as primary

class PurchaseDetail extends Model implements AuditableContract
{
use HasCompositeKey, Auditable;
public $timestamps = false;
protected $primaryKey = ['purchase_id','item_id','unit_id'];
}

Expected Behaviour

auditable_id : multi primary

Possible Solutions

making the class model not composite primary instead using id with auto increment. this solution may cause duplicate in some record.

@quetzyg
Copy link
Contributor

quetzyg commented Apr 24, 2018

I'm unaware of Eloquent supporting composite keys.

@quetzyg quetzyg self-assigned this Apr 24, 2018
@quetzyg quetzyg added the V6 label Apr 25, 2018
@quetzyg
Copy link
Contributor

quetzyg commented Apr 25, 2018

Closing due to lack of information.

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