src/Mmi/Orm/Builder.php
protected static function _updateQueryField($tableName)
    {
        //prefixy nazw
        $queryClassName = self::_getNamespace($tableName) . '\\' . self::_getNamePrefix($tableName) . 'Query';
        //odczyt struktury
        $structure = DbConnector::getTableStructure($tableName);
        $methods = '';
        //budowanie komentarzy do metod
        foreach ($structure as $fieldName => $fieldDetails) {
            $fieldName = ucfirst(Convert::underscoreToCamelcase($fieldName));
            //metody equalsColumn... np. equalsColumnActive()
            $methods .= ' * @method \\' . $queryClassName . ' equalsColumn' . $fieldName . '()' . "\n";
            //notEqualsColumn
            $methods .= ' * @method \\' . $queryClassName . ' notEqualsColumn' . $fieldName . '()' . "\n";
            //greaterThanColumn
            $methods .= ' * @method \\' . $queryClassName . ' greaterThanColumn' . $fieldName . '()' . "\n";
            //lessThanColumn
            $methods .= ' * @method \\' . $queryClassName . ' lessThanColumn' . $fieldName . '()' . "\n";
            //greaterOrEqualsColumn
            $methods .= ' * @method \\' . $queryClassName . ' greaterOrEqualsColumn' . $fieldName . '()' . "\n";
            //lessOrEqualsColumn
            $methods .= ' * @method \\' . $queryClassName . ' lessOrEqualsColumn' . $fieldName . '()' . "\n";
        }
        //anotacje dla metod porównujących (equals itp.)
        $queryCode = '<?php' . "\n\n" .
            'namespace ' . self::_getNamespace($tableName) . '\QueryHelper' . ";\n\n" .
            '/**' . "\n" .
            ' * @method \\' . $queryClassName . ' equals($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' notEquals($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' greater($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' less($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' greaterOrEquals($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' lessOrEquals($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' like($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' notLike($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' between($from, $to)' . "\n" .
            $methods .
            ' */' . "\n" .
            'class ' . ($className = self::_getNamePrefix($tableName) . 'QueryField') . ' extends \Mmi\Orm\QueryHelper\QueryField' .
            "\n{" .
            "\n\n" .
            '}' . "\n";
        //zapis pliku
        file_put_contents(self::_mkdirRecursive(self::_getPathPrefix($tableName) . '/QueryHelper') . '/' . $className . '.php', $queryCode);
    }
protected static function _updateQueryField($tableName)
    {
        //prefixy nazw
        $queryClassName = self::_getNamespace($tableName) . '\\' . self::_getNamePrefix($tableName) . 'Query';
        //odczyt struktury
        $structure = DbConnector::getTableStructure($tableName);
        $methods = '';
        //budowanie komentarzy do metod
        foreach ($structure as $fieldName => $fieldDetails) {
            $fieldName = ucfirst(Convert::underscoreToCamelcase($fieldName));
            //metody equalsColumn... np. equalsColumnActive()
            $methods .= ' * @method \\' . $queryClassName . ' equalsColumn' . $fieldName . '()' . "\n";
            //notEqualsColumn
            $methods .= ' * @method \\' . $queryClassName . ' notEqualsColumn' . $fieldName . '()' . "\n";
            //greaterThanColumn
            $methods .= ' * @method \\' . $queryClassName . ' greaterThanColumn' . $fieldName . '()' . "\n";
            //lessThanColumn
            $methods .= ' * @method \\' . $queryClassName . ' lessThanColumn' . $fieldName . '()' . "\n";
            //greaterOrEqualsColumn
            $methods .= ' * @method \\' . $queryClassName . ' greaterOrEqualsColumn' . $fieldName . '()' . "\n";
            //lessOrEqualsColumn
            $methods .= ' * @method \\' . $queryClassName . ' lessOrEqualsColumn' . $fieldName . '()' . "\n";
        }
        //anotacje dla metod porównujących (equals itp.)
        $queryCode = '<?php' . "\n\n" .
            'namespace ' . self::_getNamespace($tableName) . '\QueryHelper' . ";\n\n" .
            '/**' . "\n" .
            ' * @method \\' . $queryClassName . ' equals($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' notEquals($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' greater($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' less($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' greaterOrEquals($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' lessOrEquals($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' like($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' notLike($value)' . "\n" .
            ' * @method \\' . $queryClassName . ' between($from, $to)' . "\n" .
            $methods .
            ' */' . "\n" .
            'class ' . ($className = self::_getNamePrefix($tableName) . 'QueryField') . ' extends \Mmi\Orm\QueryHelper\QueryField' .
            "\n{" .
            "\n\n" .
            '}' . "\n";
        //zapis pliku
        file_put_contents(self::_mkdirRecursive(self::_getPathPrefix($tableName) . '/QueryHelper') . '/' . $className . '.php', $queryCode);
    }
protected static function _updateQueryField ( $ tableName ) { //prefixy nazw $ queryClassName = self :: _getNamespace ( $ tableName ) . '\\' . self :: _getNamePrefix ( $ tableName ) . 'Query' ; //odczyt struktury $ structure = DbConnector :: getTableStructure ( $ tableName ) ; $ methods = '' ; //budowanie komentarzy do metod foreach ( $ structure as $ fieldName => $ fieldDetails ) { $ fieldName = ucfirst ( Convert :: underscoreToCamelcase ( $ fieldName ) ) ; //metody equalsColumn... np. equalsColumnActive() $ methods .= ' * @method \\' . $ queryClassName . ' equalsColumn' . $ fieldName . '()' . "\n" ; //notEqualsColumn $ methods .= ' * @method \\' . $ queryClassName . ' notEqualsColumn' . $ fieldName . '()' . "\n" ; //greaterThanColumn $ methods .= ' * @method \\' . $ queryClassName . ' greaterThanColumn' . $ fieldName . '()' . "\n" ; //lessThanColumn $ methods .= ' * @method \\' . $ queryClassName . ' lessThanColumn' . $ fieldName . '()' . "\n" ; //greaterOrEqualsColumn $ methods .= ' * @method \\' . $ queryClassName . ' greaterOrEqualsColumn' . $ fieldName . '()' . "\n" ; //lessOrEqualsColumn $ methods .= ' * @method \\' . $ queryClassName . ' lessOrEqualsColumn' . $ fieldName . '()' . "\n" ; } //anotacje dla metod porównujących (equals itp.) $ queryCode = '<?php' . "\n\n" . 'namespace ' . self :: _getNamespace ( $ tableName ) . '\QueryHelper' . ";\n\n" . '/**' . "\n" . ' * @method \\' . $ queryClassName . ' equals($value)' . "\n" . ' * @method \\' . $ queryClassName . ' notEquals($value)' . "\n" . ' * @method \\' . $ queryClassName . ' greater($value)' . "\n" . ' * @method \\' . $ queryClassName . ' less($value)' . "\n" . ' * @method \\' . $ queryClassName . ' greaterOrEquals($value)' . "\n" . ' * @method \\' . $ queryClassName . ' lessOrEquals($value)' . "\n" . ' * @method \\' . $ queryClassName . ' like($value)' . "\n" . ' * @method \\' . $ queryClassName . ' notLike($value)' . "\n" . ' * @method \\' . $ queryClassName . ' between($from, $to)' . "\n" . $ methods . ' */' . "\n" . 'class ' . ( $ className = self :: _getNamePrefix ( $ tableName ) . 'QueryField' ) . ' extends \Mmi\Orm\QueryHelper\QueryField' . "\n{" . "\n\n" . '}' . "\n" ; //zapis pliku file_put_contents ( self :: _mkdirRecursive ( self :: _getPathPrefix ( $ tableName ) . '/QueryHelper' ) . '/' . $ className . '.php' , $ queryCode ) ; }
Tworzy lub aktualizuje pole query
@param string $tableName
Tworzy lub aktualizuje pole query