Action/BuildAction.php
protected function preparePrimaryConstraint(DOMElement $table, DOMXPath $xpath, Table $schemaTable)
    {
        $primaryTags = $xpath->query(sprintf('/database/table[@name="%s"]/primary', $table->getAttribute('name')));

        /** @var DOMElement $primaryTag */
        foreach ($primaryTags as $primaryTag) {
            $primaryColumns = $primaryTag->getElementsByTagName('primary-column');
            $constraintName = $primaryTag->getAttribute('name');

            $tmpPrimaryColumn = [];
            /** @var DOMElement $primaryColumn */
            foreach ($primaryColumns as $primaryColumn) {
                $tmpPrimaryColumn[] = $primaryColumn->getAttribute('name');
            }

            if (empty(trim($constraintName))) {
                $constraintName = sprintf(
                    '%s_%s_%s',
                    $table->getAttribute('name'),
                    implode('_', $tmpPrimaryColumn),
                    'primary'
                );
            }

            $schemaTable->addConstraint(
                $constraintName,
                [
                    'type' => 'primary',
                    'columns' => $tmpPrimaryColumn
                ]
            );
        }
    }
protected function preparePrimaryConstraint(DOMElement $table, DOMXPath $xpath, Table $schemaTable)
    {
        $primaryTags = $xpath->query(sprintf('/database/table[@name="%s"]/primary', $table->getAttribute('name')));

        /** @var DOMElement $primaryTag */
        foreach ($primaryTags as $primaryTag) {
            $primaryColumns = $primaryTag->getElementsByTagName('primary-column');
            $constraintName = $primaryTag->getAttribute('name');

            $tmpPrimaryColumn = [];
            /** @var DOMElement $primaryColumn */
            foreach ($primaryColumns as $primaryColumn) {
                $tmpPrimaryColumn[] = $primaryColumn->getAttribute('name');
            }

            if (empty(trim($constraintName))) {
                $constraintName = sprintf(
                    '%s_%s_%s',
                    $table->getAttribute('name'),
                    implode('_', $tmpPrimaryColumn),
                    'primary'
                );
            }

            $schemaTable->addConstraint(
                $constraintName,
                [
                    'type' => 'primary',
                    'columns' => $tmpPrimaryColumn
                ]
            );
        }
    }
protected function preparePrimaryConstraint ( DOMElement $ table , DOMXPath $ xpath , Table $ schemaTable ) { $ primaryTags = $ xpath -> query ( sprintf ( '/database/table[@name="%s"]/primary' , $ table -> getAttribute ( 'name' ) ) ) ; /** @var DOMElement $primaryTag */ foreach ( $ primaryTags as $ primaryTag ) { $ primaryColumns = $ primaryTag -> getElementsByTagName ( 'primary-column' ) ; $ constraintName = $ primaryTag -> getAttribute ( 'name' ) ; $ tmpPrimaryColumn = [ ] ; /** @var DOMElement $primaryColumn */ foreach ( $ primaryColumns as $ primaryColumn ) { $ tmpPrimaryColumn [ ] = $ primaryColumn -> getAttribute ( 'name' ) ; } if ( empty ( trim ( $ constraintName ) ) ) { $ constraintName = sprintf ( '%s_%s_%s' , $ table -> getAttribute ( 'name' ) , implode ( '_' , $ tmpPrimaryColumn ) , 'primary' ) ; } $ schemaTable -> addConstraint ( $ constraintName , [ 'type' => 'primary' , 'columns' => $ tmpPrimaryColumn ] ) ; } }
Prepare primary constraint

@param DOMElement $table
@param DOMXPath   $xpath
@param Table      $schemaTable
Prepare primary constraint