lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
public function getCheckDeclarationSQL(array $definition)
    {
        $constraints = [];
        foreach ($definition as $field => $def) {
            if (is_string($def)) {
                $constraints[] = 'CHECK (' . $def . ')';
            } else {
                if (isset($def['min'])) {
                    $constraints[] = 'CHECK (' . $field . ' >= ' . $def['min'] . ')';
                }

                if (isset($def['max'])) {
                    $constraints[] = 'CHECK (' . $field . ' <= ' . $def['max'] . ')';
                }
            }
        }

        return implode(', ', $constraints);
    }
public function getCheckDeclarationSQL(array $definition)
    {
        $constraints = [];
        foreach ($definition as $field => $def) {
            if (is_string($def)) {
                $constraints[] = 'CHECK (' . $def . ')';
            } else {
                if (isset($def['min'])) {
                    $constraints[] = 'CHECK (' . $field . ' >= ' . $def['min'] . ')';
                }

                if (isset($def['max'])) {
                    $constraints[] = 'CHECK (' . $field . ' <= ' . $def['max'] . ')';
                }
            }
        }

        return implode(', ', $constraints);
    }
public function getCheckDeclarationSQL ( array $ definition ) { $ constraints = [ ] ; foreach ( $ definition as $ field => $ def ) { if ( is_string ( $ def ) ) { $ constraints [ ] = 'CHECK (' . $ def . ')' ; } else { if ( isset ( $ def [ 'min' ] ) ) { $ constraints [ ] = 'CHECK (' . $ field . ' >= ' . $ def [ 'min' ] . ')' ; } if ( isset ( $ def [ 'max' ] ) ) { $ constraints [ ] = 'CHECK (' . $ field . ' <= ' . $ def [ 'max' ] . ')' ; } } } return implode ( ', ' , $ constraints ) ; }
Obtains DBMS specific SQL code portion needed to set a CHECK constraint
declaration to be used in statements like CREATE TABLE.

@param string[]|mixed[][] $definition The check definition.

@return string DBMS specific SQL code portion needed to set a CHECK constraint.
Obtains DBMS specific SQL code portion needed to set a CHECK constraint declaration to be used in statements like CREATE TABLE .