public function getBelongsToReference($table, $key)
{
$tableColumns = $this->structure->getBelongsToReference($table);
foreach ($tableColumns as $column => $targetTable) {
if (stripos($column, $key) !== FALSE) {
return [$targetTable, $column];
}
}
if ($this->structure->isRebuilt()) {
return NULL;
}
$this->structure->rebuild();
return $this->getBelongsToReference($table, $key);
}