Tworzy konstrukcję sprawdzającą null w silniku bazy danych
@param string $fieldName nazwa pola
@param boolean $positive sprawdza czy null, lub czy nie null
@return string
507400
public function prepareNullCheck($fieldName, $positive = true)
    {
        //sprawdzanie czy null lub nie null
        return $positive ? ('(' . $fieldName . ' is null OR ' . $fieldName . ' = ' . $this->quote('') . ')') : ($fieldName . ' is not null');
    }
903456
public function old($fieldName)
    {
        if ($this->isMethod('get') && $this->session->has('planet_oldInput')) {

            $oldInput = $this->session->get('planet_oldInput');

            return ($oldInput != null) ? $oldInput[$fieldName] : '';

        }
    }
1139146
public function getSingleByField($fieldName, $key)
    {
        $record = $this->setMaxResults(1)->getByField($fieldName, $key);

        return reset($record);
    }
1291532
public function getField($fieldName)
    {
        if (array_key_exists($fieldName, $this->_message)) {
            return $this->_message[$fieldName];
        } else {
            return null;
        }
    }
969656
private function canonicalizeFieldValue($fieldname, $fieldvalue)
    {
        switch ($fieldname) {
            case 'email':
                return strtolower(trim($fieldvalue));

            case 'username':
                return strtolower(preg_replace('/[^a-zA-Z0-9_\\-]/', '', $fieldvalue));

            default:
                return trim($fieldvalue);
        }
    }
1243853
public function createField($fieldName, $defaultValue = null)
    {
        $fieldType = $this->fieldType;
        $field = $fieldType::create($fieldName, $this->Title, $defaultValue);
        $field->addExtraClass($this->ExtraClass);
        $this->extend('updateCreateField', $field);
        return $field;
    }
514670
public function prepareFieldName($fieldName)
    {
        list($fieldName) = $this->prepareQueryElement($fieldName, null, null, false);

        return $fieldName;
    }
1316545
protected function getFieldName($fieldName)
	{
		if ($fieldName)
		{
			return $fieldName;
		}
		else
		{
			self::$count = self::$count + 1;

			return self::$generated_fieldname . self::$count;
		}
	}
895095
public function getField($fieldName) {
        if(empty($fieldName)) {
            throw new \InvalidArgumentException('Please provide a fieldname');
        }
        
        $values = array();
        foreach($this->fields as $field) {
            if($field['name'] == $fieldName) {
                $values[] = $field['value'];
            }
        }
        
        return $values;
    }
353014
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);
    }
247909
public function removeFilterByFieldName($fieldName)
    {
        return $this->removeFilterByFunction(
            function($key, $query) use ($fieldName) {
                $queryString = $query->getQuery();
                $storedFieldName = substr($queryString,0, strpos($queryString, ":"));
                return $storedFieldName == $fieldName;
            }
        );
    }
635567
protected static function _getPathPrefix($tableName)
    {
        $table = explode('_', $tableName);
        //klasy leżą w plikach w /Orm/
        $baseDir = BASE_PATH . '/src/' . ucfirst($table[0]) . '/Orm';
        return $baseDir;
    }
390264
public function getField($fieldname) {
        $i = $this->findFieldInArray($fieldname);
        if ($i !== null) {
            return $this->fields[$i];
        }
        return null;
    }
1157614
protected function _prepareColumnQuery($columnName, $tableName = null, $condition = '=')
    {
        //inicjalizacja zapytania
        $this->_initQuery();
        //porównanie z kolumną
        $this->_query->getQueryCompile()->where .= $this->_fieldName . ' ' . $condition . ' ' . DbConnector::getAdapter()->prepareTable((null === $tableName) ? $this->_query->getTableName() : $tableName) . '.' . DbConnector::getAdapter()->prepareField($columnName);
        return $this->_query;
    }
321602
protected final function _prepareField($fieldName, $forcedTableName = null)
    {
        //funkcja sortująca rand()
        if ($fieldName == 'RAND()') {
            return DbConnector::getAdapter()->prepareField('RAND()');
        }
        //nazwa tabeli
        $tableName = ($forcedTableName === null) ? $this->_tableName : $forcedTableName;
        //przygotowany prefix tabeli
        $tablePrefix = DbConnector::getAdapter()->prepareTable($tableName);
        //pole występuje w tabeli (jeden do jednego bez żadnych konwersji)
        if (DbConnector::fieldInTable($fieldName, $tableName)) {
            return $tablePrefix . '.' . DbConnector::getAdapter()->prepareField($fieldName);
        }
        //konwersja camelcase na podkreślenia
        return $tablePrefix . '.' . DbConnector::getAdapter()->prepareField(Convert::camelcaseToUnderscore($fieldName));
    }
315172
public function sql_regex($positivematch = true, $casesensitive = false) {
        $collation = '';
        if ($casesensitive) {
            if (substr($this->get_dbcollation(), -4) !== '_bin') {
                $collationinfo = explode('_', $this->get_dbcollation());
                $collation = 'COLLATE ' . $collationinfo[0] . '_bin ';
            }
        } else {
            if ($this->get_dbcollation() == 'utf8_bin') {
                $collation = 'COLLATE utf8_unicode_ci ';
            } else if ($this->get_dbcollation() == 'utf8mb4_bin') {
                $collation = 'COLLATE utf8mb4_unicode_ci ';
            }
        }

        return $collation . ($positivematch ? 'REGEXP' : 'NOT REGEXP');
    }
152632
public function getFieldBc($fieldName)
    {
        if (array_key_exists($fieldName, $this->bcFields)) {
            return $this->bcFields[$fieldName];
        }

        return $fieldName;
    }