public function generateExistRules($table, $columnBehaviors)
    {
        $rules = [];
        foreach ($table->foreignKeys as $refs) {
            $refClassName = $this->generateClassName($refs[0]);
            unset($refs[0]);
            $attributes = implode("', '", array_keys($refs));
            $targetAttributes = [];
            foreach ($refs as $key => $value) {
                if (isset($columnBehaviors[$key]) && $columnBehaviors[$key] !== false) {
                    continue 2;
                }
                $targetAttributes[] = "'$key' => '$value'";
            }
            $targetAttributes = implode(', ', $targetAttributes);
            $rules[] = "[['$attributes'], 'exist', 'skipOnError' => true, "
                . "'targetClass' => $refClassName::className(), 'targetAttribute' => [$targetAttributes]],";
        }
        return $rules;
    }