{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/ideas/issues/1221","repository_url":"https://api.github.com/repos/laravel/ideas","labels_url":"https://api.github.com/repos/laravel/ideas/issues/1221/labels{/name}","comments_url":"https://api.github.com/repos/laravel/ideas/issues/1221/comments","events_url":"https://api.github.com/repos/laravel/ideas/issues/1221/events","html_url":"https://github.com/laravel/ideas/issues/1221","id":331466366,"node_id":"MDU6SXNzdWUzMzE0NjYzNjY=","number":1221,"title":"ConnectionInterface and their implementations","user":{"login":"NoelDeMartin","id":1517677,"node_id":"MDQ6VXNlcjE1MTc2Nzc=","avatar_url":"https://avatars3.githubusercontent.com/u/1517677?v=4","gravatar_id":"","url":"https://api.github.com/users/NoelDeMartin","html_url":"https://github.com/NoelDeMartin","followers_url":"https://api.github.com/users/NoelDeMartin/followers","following_url":"https://api.github.com/users/NoelDeMartin/following{/other_user}","gists_url":"https://api.github.com/users/NoelDeMartin/gists{/gist_id}","starred_url":"https://api.github.com/users/NoelDeMartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NoelDeMartin/subscriptions","organizations_url":"https://api.github.com/users/NoelDeMartin/orgs","repos_url":"https://api.github.com/users/NoelDeMartin/repos","events_url":"https://api.github.com/users/NoelDeMartin/events{/privacy}","received_events_url":"https://api.github.com/users/NoelDeMartin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-06-12T07:20:04Z","updated_at":"2018-06-12T09:53:51Z","closed_at":null,"author_association":"NONE","body":"After some frustrating experiences working with existing mongodb packages for Laravel, I decided to dip my toes on a test project and implement mongodb integration from scratch. And just from the get go, I found some design incongruencies that I think should be fixed, regardless of mongodb or nosql support in general. Seeing this I also suspect the same problem may be present in other parts of the code, so I want to discuss this before looking elsewhere.\r\n\r\nThe problem I found is the following. There is currently an interface under the Database namespace called `ConnectionInterface`. To anyone who wants to implement a new connection, I assume this is the interface to implement. However, after implementing this interface I got an error coming from the `DatabaseManager`, because it has different methods that take a `Connection` instance, not a `ConnectionInterface`. So I went ahead and also re-implemented the database manager, using the interface `ConnectionResolverInterface`. This was not ideal, but still correct from a design perspective. But then I found the first incorrect scenario. When running migrations, the class `DatabaseMigrationRepository` is used. This class takes as an argument in the constructor a `ConnectionResolverInterface`, however `$this->getConnection()->getSchemaBuilder();` is called in multiple ocasions. This is not correct, because the object returned by `getConnection` is a `ConnectionInterface`, which lacks the `getSchemaBuilder` method. In order to fix this, either the `ConnectionResolverInterface` should be modified to return a `Connection` or the `ConnectionInterface` should be modified to include the `getSchemaBuilder` method.\r\n\r\nI guess you can already see the problem here. I won't go further than this particular example, but this same problem is present in other places. This effectively makes the `ConnectionInterface` useless because you need to end up extending the `Connection` class itself in most cases.\r\n\r\nI am aware that this does not have an easy fix, because modifying interfaces has the potential to break a lot of existing code. But I think this should be fixed at some point, or it has the potential to become worse with time."},"comment":{"url":"https://api.github.com/repos/laravel/ideas/issues/comments/396533781","html_url":"https://github.com/laravel/ideas/issues/1221#issuecomment-396533781","issue_url":"https://api.github.com/repos/laravel/ideas/issues/1221","id":396533781,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjUzMzc4MQ==","user":{"login":"RemiCollin","id":9589616,"node_id":"MDQ6VXNlcjk1ODk2MTY=","avatar_url":"https://avatars2.githubusercontent.com/u/9589616?v=4","gravatar_id":"","url":"https://api.github.com/users/RemiCollin","html_url":"https://github.com/RemiCollin","followers_url":"https://api.github.com/users/RemiCollin/followers","following_url":"https://api.github.com/users/RemiCollin/following{/other_user}","gists_url":"https://api.github.com/users/RemiCollin/gists{/gist_id}","starred_url":"https://api.github.com/users/RemiCollin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RemiCollin/subscriptions","organizations_url":"https://api.github.com/users/RemiCollin/orgs","repos_url":"https://api.github.com/users/RemiCollin/repos","events_url":"https://api.github.com/users/RemiCollin/events{/privacy}","received_events_url":"https://api.github.com/users/RemiCollin/received_events","type":"User","site_admin":false},"created_at":"2018-06-12T09:53:51Z","updated_at":"2018-06-12T09:53:51Z","author_association":"NONE","body":"I totally agree it has to be improved if we want to add custom DB implementations; And as a mongoDB user, I'm interested in your project, as the current popular solution really feels abandoned by its maintainer. "}}
{"actor":{"display_login":"RemiCollin"}}