-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
DOCSP-42956: Remove $collection support #3138
DOCSP-42956: Remove $collection support #3138
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with a wording change suggestion
docs/upgrade.txt
Outdated
- ``Model::collection()``: use ``Model::table()`` | ||
- ``DB::collection()``: use ``DB::table()`` | ||
- ``Connection::collection()``: use ``Connection::table()`` | ||
- ``Schema::collection()``: use ``Schema::table()`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually there is only 2 methods removed in MongoDB\Laravel\Connection
and MongoDB\Laravel\Schema\Builder
, where they can be used as instance method.
But they are exposed in the Laravel facades Illuminate\Support\Facades\DB
and Illuminate\Support\Facades
, which expose them as static method. (Yes, this is very confusing).
- ``Model::collection()``: use ``Model::table()`` | |
- ``DB::collection()``: use ``DB::table()`` | |
- ``Connection::collection()``: use ``Connection::table()`` | |
- ``Schema::collection()``: use ``Schema::table()`` | |
- ``DB::collection()``: use ``DB::table()`` | |
- ``Schema::collection()``: use ``Schema::table()`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I see, updated! Should I mention the static methods here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better with a diff of the changes to be made.
use MongoDB\Laravel\Eloquent\Model;
class User extends Model
{
protected $keyType = 'string';
- protected $collection = 'app_user';
+ protected $table = 'app_user';
...
}
use Illuminate\Support\Facades\DB;
- DB::collection('app_user')->find($id);
+ DB::table('app_user')->find($id);
use Illuminate\Support\Facades\Schema;
use MongoDB\Laravel\Schema\Blueprint;
- Schema::collection('app_user', function (Blueprint $collection) { ... });
+ Schema::table('app_user', function (Blueprint $table) { ... });
JIRA - https://jira.mongodb.org/browse/DOCSP-42956
Staging - https://deploy-preview-136--docs-laravel.netlify.app/upgrade/#version-5.x-breaking-changes
Checklist