Skip to content

Commit 01d7af9

Browse files
authored
Deprecate Mongo soft deletes trait (#3408)
In favor of the Laravel one. Ours is now obsolete; the SoftDeletes trait is only necessary to remove the call to qualifyColumn in the parent trait. But the DocumentModel::qualifyColumn is already disabled
1 parent 21d4d28 commit 01d7af9

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

src/Eloquent/MassPrunable.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace MongoDB\Laravel\Eloquent;
66

77
use Illuminate\Database\Eloquent\MassPrunable as EloquentMassPrunable;
8+
use Illuminate\Database\Eloquent\SoftDeletes;
89
use Illuminate\Database\Events\ModelsPruned;
910

1011
use function class_uses_recursive;

src/Eloquent/SoftDeletes.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
namespace MongoDB\Laravel\Eloquent;
66

7+
use function sprintf;
8+
use function trigger_error;
9+
10+
use const E_USER_DEPRECATED;
11+
12+
trigger_error(sprintf('Since mongodb/laravel-mongodb:5.5, trait "%s" is deprecated, use "%s" instead.', SoftDeletes::class, \Illuminate\Database\Eloquent\SoftDeletes::class), E_USER_DEPRECATED);
13+
14+
/** @deprecated since mongodb/laravel-mongodb:5.5, use \Illuminate\Database\Eloquent\SoftDeletes instead */
715
trait SoftDeletes
816
{
917
use \Illuminate\Database\Eloquent\SoftDeletes;

tests/Models/Soft.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
use Carbon\Carbon;
88
use Illuminate\Database\Eloquent\Model;
9+
use Illuminate\Database\Eloquent\SoftDeletes;
910
use MongoDB\Laravel\Eloquent\Builder;
1011
use MongoDB\Laravel\Eloquent\DocumentModel;
1112
use MongoDB\Laravel\Eloquent\MassPrunable;
12-
use MongoDB\Laravel\Eloquent\SoftDeletes;
1313

1414
/** @property Carbon $deleted_at */
1515
class Soft extends Model

tests/Scout/Models/ScoutUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
namespace MongoDB\Laravel\Tests\Scout\Models;
66

77
use Illuminate\Database\Eloquent\Model;
8+
use Illuminate\Database\Eloquent\SoftDeletes;
89
use Illuminate\Database\Schema\Blueprint;
910
use Illuminate\Database\Schema\SQLiteBuilder;
1011
use Illuminate\Support\Facades\Schema;
1112
use Laravel\Scout\Searchable;
12-
use MongoDB\Laravel\Eloquent\SoftDeletes;
1313

1414
use function assert;
1515

0 commit comments

Comments
 (0)