protected isHasManyRelation ( yii\db\TableSchema $table, array $fks ) : boolean | ||
$table | yii\db\TableSchema | |
$fks | array | |
Résultat | boolean |
protected function isHasManyRelation($table, $fks)
{
$uniqueKeys = [$table->primaryKey];
try {
$uniqueKeys = array_merge($uniqueKeys, $this->getDbConnection()->getSchema()->findUniqueIndexes($table));
} catch (NotSupportedException $e) {
// ignore
}
foreach ($uniqueKeys as $uniqueKey) {
if (count(array_diff(array_merge($uniqueKey, $fks), array_intersect($uniqueKey, $fks))) === 0) {
return false;
}
}
return true;
}