Skip to content

Commit

Permalink
using ss4 DataObjectSchema::getTableForFiled
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelSuwinski committed Jun 6, 2022
1 parent 96ccd9e commit 05fede7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public static function getTableForField($className, $field) {
// Let's get our hands dirty on this ancestry filth and reference the database because the private static ::$db isn't reliable (seriously).
$ancestors = ClassInfo::ancestry($className, true);
foreach($ancestors as $ancestor) {
if ($tableName = DataObject::getSchema()->tableName($ancestor)) {
if (DB::get_schema()->hasField($tableName, $field)) return $ancestor;
if ($tableName = DataObject::getSchema()->tableForField($ancestor, $field)) {
return $ancestor;
}
}

Expand Down

0 comments on commit 05fede7

Please sign in to comment.