private final function constraint(TableInterface $table): string
    {
        $mySql = $selfKey = $foreignKey = "";
        $name = $table->get($table::ATTR_NAME);
        foreach ($table->get($table::ATTR_KEY) as $key => $value) {
            if (KeyInterface::FOREIGN !== $value->getType()) {
                $selfKey .= $this->addKey($value, $name . "_" . $key);
                if (KeyInterface::PRIMARY === $value->getType()) {
                    foreach ($value->getSubject() as $key) {
                        $selfKey .= $this->addAutoIncrement(
                            $key,
                            $table->get($table::ATTR_COLUMN));
                    }
                }
                continue;
            }
            $foreignKey .= $this->addForeign($value, $name . "_" . $key);
        }
        foreach ([$selfKey, $foreignKey] as $value) {
            $mySql .= $value ? "ALTER TABLE `" . $name . "`\n"
                             . substr($value, 0, -2) . ";\n"
                             : $value;
        }
        return substr($mySql, 0, -1);
    }
private final function constraint(TableInterface $table): string
    {
        $mySql = $selfKey = $foreignKey = "";
        $name = $table->get($table::ATTR_NAME);
        foreach ($table->get($table::ATTR_KEY) as $key => $value) {
            if (KeyInterface::FOREIGN !== $value->getType()) {
                $selfKey .= $this->addKey($value, $name . "_" . $key);
                if (KeyInterface::PRIMARY === $value->getType()) {
                    foreach ($value->getSubject() as $key) {
                        $selfKey .= $this->addAutoIncrement(
                            $key,
                            $table->get($table::ATTR_COLUMN));
                    }
                }
                continue;
            }
            $foreignKey .= $this->addForeign($value, $name . "_" . $key);
        }
        foreach ([$selfKey, $foreignKey] as $value) {
            $mySql .= $value ? "ALTER TABLE `" . $name . "`\n"
                             . substr($value, 0, -2) . ";\n"
                             : $value;
        }
        return substr($mySql, 0, -1);
    }
private final function constraint ( TableInterface $ table ) : string { $ mySql = $ selfKey = $ foreignKey = "" ; $ name = $ table -> get ( $ table :: ATTR_NAME ) ; foreach ( $ table -> get ( $ table :: ATTR_KEY ) as $ key => $ value ) { if ( KeyInterface :: FOREIGN !== $ value -> getType ( ) ) { $ selfKey .= $ this -> addKey ( $ value , $ name . "_" . $ key ) ; if ( KeyInterface :: PRIMARY === $ value -> getType ( ) ) { foreach ( $ value -> getSubject ( ) as $ key ) { $ selfKey .= $ this -> addAutoIncrement ( $ key , $ table -> get ( $ table :: ATTR_COLUMN ) ) ; } } continue ; } $ foreignKey .= $ this -> addForeign ( $ value , $ name . "_" . $ key ) ; } foreach ( [ $ selfKey , $ foreignKey ] as $ value ) { $ mySql .= $ value ? "ALTER TABLE `" . $ name . "`\n" . substr ( $ value , 0 , - 2 ) . ";\n" : $ value ; } return substr ( $ mySql , 0 , - 1 ) ; }
Get constraint syntaxe

@param TableInterface $table table
@return string constraint syntaxe
Get constraint syntaxe