Skip to content

Commit 67036d7

Browse files
authored
Revert "Option to use table names when morphing (#38451)" (#38463)
This reverts commit 5d5655b.
1 parent 5d5655b commit 67036d7

File tree

3 files changed

+1
-30
lines changed

3 files changed

+1
-30
lines changed

src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,9 +731,7 @@ public function getMorphClass()
731731
return array_search(static::class, $morphMap, true);
732732
}
733733

734-
return Relation::$useTableNamesForMorphMap
735-
? $this->getTable()
736-
: static::class;
734+
return static::class;
737735
}
738736

739737
/**

src/Illuminate/Database/Eloquent/Relations/Relation.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ abstract class Relation
5050
*/
5151
protected static $constraints = true;
5252

53-
/**
54-
* Indicates that table names should be used when determining morph classes.
55-
*
56-
* @var bool
57-
*/
58-
public static $useTableNamesForMorphMap = false;
59-
6053
/**
6154
* An array to map class names to their morph names in the database.
6255
*
@@ -383,16 +376,6 @@ protected function whereInMethod(Model $model, $key)
383376
: 'whereIn';
384377
}
385378

386-
/**
387-
* Indicate that the table names should be used when determining morphed class names.
388-
*
389-
* @return void
390-
*/
391-
public static function morphUsingTableNames()
392-
{
393-
static::$useTableNamesForMorphMap = true;
394-
}
395-
396379
/**
397380
* Set or get the morph map for polymorphic relations.
398381
*

tests/Database/DatabaseEloquentModelTest.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,16 +1217,6 @@ public function testMorphOneCreatesProperRelation()
12171217
$this->assertEquals(EloquentModelStub::class, $relation->getMorphClass());
12181218
}
12191219

1220-
public function testMorphOneCreatesProperRelationWhenUsingTableNames()
1221-
{
1222-
Relation::morphUsingTableNames();
1223-
$model = new EloquentModelStub;
1224-
$this->addMockConnection($model);
1225-
$relation = $model->morphOne(EloquentModelSaveStub::class, 'morph');
1226-
$this->assertEquals('stub', $relation->getMorphClass());
1227-
Relation::$useTableNamesForMorphMap = false;
1228-
}
1229-
12301220
public function testCorrectMorphClassIsReturned()
12311221
{
12321222
Relation::morphMap(['alias' => 'AnotherModel']);

0 commit comments

Comments
 (0)