method findReferences documentation in bbn\Db\Languages\Sql

find_references

function($column, string $db = '') { $changed = false; if ($db && ($db !== $this->getCurrent())) { $changed = $this->getCurrent(); $this->change($db); } $column = $this->colFullName($column); $bits = explode('.', $column); if (\count($bits) === 2) { array_unshift($bits, $this->getCurrent()); } if (\count($bits) !== 3) { return null; } $refs = []; $schema = $this->modelize(); $test = function ($key) use ($bits) { return ($key['ref_db'] === $bits[0]) && ($key['ref_table'] === $bits[1]) && ($key['ref_column'] === $bits[2]); }; foreach ($schema as $table => $cfg){ foreach ($cfg['keys'] as $k){ if ($test($k)) { $refs[] = $table.'.'.$k['columns'][0]; } } } if ($changed) { $this->change($changed); } return $refs; }

find_references BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.