File tree 2 files changed +14
-17
lines changed
2 files changed +14
-17
lines changed Original file line number Diff line number Diff line change 20
20
use MongoDB \BSON \UTCDateTime ;
21
21
use function uniqid ;
22
22
23
- /**
24
- * @method void unset(string|string[] $columns) Remove one or more fields.
25
- */
26
23
abstract class Model extends BaseModel
27
24
{
28
25
use HybridRelations, EmbedsRelations;
@@ -341,8 +338,21 @@ public function offsetSet($offset, $value): void
341
338
*
342
339
* @param string|string[] $columns
343
340
* @return void
341
+ *
342
+ * @deprecated Use unset() instead.
344
343
*/
345
344
public function drop ($ columns )
345
+ {
346
+ $ this ->unset ($ columns );
347
+ }
348
+
349
+ /**
350
+ * Remove one or more fields.
351
+ *
352
+ * @param string|string[] $columns
353
+ * @return void
354
+ */
355
+ public function unset ($ columns )
346
356
{
347
357
$ columns = Arr::wrap ($ columns );
348
358
@@ -560,19 +570,6 @@ protected function isGuardableColumn($key)
560
570
return true ;
561
571
}
562
572
563
- /**
564
- * @inheritdoc
565
- */
566
- public function __call ($ method , $ parameters )
567
- {
568
- // Unset method
569
- if ($ method == 'unset ' ) {
570
- return $ this ->drop (...$ parameters );
571
- }
572
-
573
- return parent ::__call ($ method , $ parameters );
574
- }
575
-
576
573
/**
577
574
* @inheritdoc
578
575
*/
Original file line number Diff line number Diff line change @@ -511,7 +511,7 @@ public function testUnsetAndSet(): void
511
511
$ this ->assertTrue ($ user ->originalIsEquivalent ('note1 ' ));
512
512
513
513
// Unset the value
514
- unset( $ user[ 'note1 ' ] );
514
+ $ user-> unset ( 'note1 ' );
515
515
$ this ->assertFalse (isset ($ user ->note1 ));
516
516
$ this ->assertNull ($ user ['note1 ' ]);
517
517
$ this ->assertFalse ($ user ->originalIsEquivalent ('note1 ' ));
You can’t perform that action at this time.
0 commit comments