{"action":"created","issue":{"url":"https://api.github.com/repos/baopham/laravel-dynamodb/issues/5","labels_url":"https://api.github.com/repos/baopham/laravel-dynamodb/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/baopham/laravel-dynamodb/issues/5/comments","events_url":"https://api.github.com/repos/baopham/laravel-dynamodb/issues/5/events","html_url":"https://github.com/baopham/laravel-dynamodb/pull/5","id":127134916,"number":5,"title":"Add support for composite primary keys","user":{"login":"warrick-loyaltycorp","id":16530482,"avatar_url":"https://avatars.githubusercontent.com/u/16530482?v=3","gravatar_id":"","url":"https://api.github.com/users/warrick-loyaltycorp","html_url":"https://github.com/warrick-loyaltycorp","followers_url":"https://api.github.com/users/warrick-loyaltycorp/followers","following_url":"https://api.github.com/users/warrick-loyaltycorp/following{/other_user}","gists_url":"https://api.github.com/users/warrick-loyaltycorp/gists{/gist_id}","starred_url":"https://api.github.com/users/warrick-loyaltycorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/warrick-loyaltycorp/subscriptions","organizations_url":"https://api.github.com/users/warrick-loyaltycorp/orgs","repos_url":"https://api.github.com/users/warrick-loyaltycorp/repos","events_url":"https://api.github.com/users/warrick-loyaltycorp/events{/privacy}","received_events_url":"https://api.github.com/users/warrick-loyaltycorp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-18T00:18:10Z","updated_at":"2016-02-01T23:46:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/baopham/laravel-dynamodb/pulls/5","html_url":"https://github.com/baopham/laravel-dynamodb/pull/5","diff_url":"https://github.com/baopham/laravel-dynamodb/pull/5.diff","patch_url":"https://github.com/baopham/laravel-dynamodb/pull/5.patch"},"body":"Added support for composite keys in DynamoDB.\r\n\r\nDynamoDbModel::find() and DynamoDbModel::delete() in particular required changes to work correctly with a composite primary key.\r\n\r\nAlso added the DynamoDbModel::compositeKey property. A better approach may be to change the primary key rather than introducing the new compositeKey property. To create a model with a composite primary key:\r\n1. Set the compositeKey property to an array of the attributes in the key.\r\n2. Set the fillable property to the list of non-key attributes\r\n3. When calling find() send an array of key properties with associated values, e.g. find(['id' => 1, 'id2' => 2]).\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.png\" height=40 alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/baopham/laravel-dynamodb/5)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/baopham/laravel-dynamodb/issues/comments/178261593","html_url":"https://github.com/baopham/laravel-dynamodb/pull/5#issuecomment-178261593","issue_url":"https://api.github.com/repos/baopham/laravel-dynamodb/issues/5","id":178261593,"user":{"login":"wzedi","id":3412440,"avatar_url":"https://avatars.githubusercontent.com/u/3412440?v=3","gravatar_id":"","url":"https://api.github.com/users/wzedi","html_url":"https://github.com/wzedi","followers_url":"https://api.github.com/users/wzedi/followers","following_url":"https://api.github.com/users/wzedi/following{/other_user}","gists_url":"https://api.github.com/users/wzedi/gists{/gist_id}","starred_url":"https://api.github.com/users/wzedi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wzedi/subscriptions","organizations_url":"https://api.github.com/users/wzedi/orgs","repos_url":"https://api.github.com/users/wzedi/repos","events_url":"https://api.github.com/users/wzedi/events{/privacy}","received_events_url":"https://api.github.com/users/wzedi/received_events","type":"User","site_admin":false},"created_at":"2016-02-01T23:46:07Z","updated_at":"2016-02-01T23:46:07Z","body":"Updated tests and README.\r\nAlso working on support for optimistic locking and timestamps. Will send new pull request for those changes.\r\n\r\nI've found I had conflicts when using multiple tables, e.g. If I add the composite key test with a new table and use CompositeTestModel for that table, after instantiating CompositeTestModel and then referring to an instance of TestModel $model->getTable() returns the composite_test_model table causing errors.\r\n\r\nI removed the Singleton $instance from DynamoDbModel to avoid this conflict."}}