Returns the difference between the fields $field1 and $field2.

If there are differences this method returns $field2, otherwise the
boolean false.

@return string[]
183883
public function diffColumn(Column $column1, Column $column2)
    {
        $properties1 = $column1->toArray();
        $properties2 = $column2->toArray();

        $changedProperties = [];

        foreach (['type', 'notnull', 'unsigned', 'autoincrement'] as $property) {
            if ($properties1[$property] === $properties2[$property]) {
                continue;
            }

            $changedProperties[] = $property;
        }

        // This is a very nasty hack to make comparator work with the legacy json_array type, which should be killed in v3
        if ($this->isALegacyJsonComparison($properties1['type'], $properties2['type'])) {
            array_shift($changedProperties);

            $changedProperties[] = 'comment';
        }

        // Null values need to be checked additionally as they tell whether to create or drop a default value.
        // null != 0, null != false, null != '' etc. This affects platform's table alteration SQL generation.
        if (($properties1['default'] === null) !== ($properties2['default'] === null)
            || $properties1['default'] != $properties2['default']) {
            $changedProperties[] = 'default';
        }

        if (($properties1['type'] instanceof Types\StringType && ! $properties1['type'] instanceof Types\GuidType) ||
            $properties1['type'] instanceof Types\BinaryType
        ) {
            // check if value of length is set at all, default value assumed otherwise.
            $length1 = $properties1['length'] ?: 255;
            $length2 = $properties2['length'] ?: 255;
            if ($length1 !== $length2) {
                $changedProperties[] = 'length';
            }

            if ($properties1['fixed'] !== $properties2['fixed']) {
                $changedProperties[] = 'fixed';
            }
        } elseif ($properties1['type'] instanceof Types\DecimalType) {
            if (($properties1['precision'] ?: 10) !== ($properties2['precision'] ?: 10)) {
                $changedProperties[] = 'precision';
            }
            if ($properties1['scale'] !== $properties2['scale']) {
                $changedProperties[] = 'scale';
            }
        }

        // A null value and an empty string are actually equal for a comment so they should not trigger a change.
        if ($properties1['comment'] !== $properties2['comment'] &&
            ! ($properties1['comment'] === null && $properties2['comment'] === '') &&
            ! ($properties2['comment'] === null && $properties1['comment'] === '')
        ) {
            $changedProperties[] = 'comment';
        }

        $customOptions1 = $column1->getCustomSchemaOptions();
        $customOptions2 = $column2->getCustomSchemaOptions();

        foreach (array_merge(array_keys($customOptions1), array_keys($customOptions2)) as $key) {
            if (! array_key_exists($key, $properties1) || ! array_key_exists($key, $properties2)) {
                $changedProperties[] = $key;
            } elseif ($properties1[$key] !== $properties2[$key]) {
                $changedProperties[] = $key;
            }
        }

        $platformOptions1 = $column1->getPlatformOptions();
        $platformOptions2 = $column2->getPlatformOptions();

        foreach (array_keys(array_intersect_key($platformOptions1, $platformOptions2)) as $key) {
            if ($properties1[$key] === $properties2[$key]) {
                continue;
            }

            $changedProperties[] = $key;
        }

        return array_unique($changedProperties);
    }
660820
public function calculateChangeSet()
    {
        if (false === $this->isDirty()) {
            return [];
        }
        return [
            'old' => empty($this->original) ? null : $this->original,
            'new' => empty($this->models) ? null : $this->models,
        ];
    }
1011485
public function fields(array $fields)
    {
        $fields = self::filter($fields);
        $diff   = array_diff($fields, Config::table($this->name)->fields());

        if (empty($diff))
        {
            return true;
        }
        throw new dbException('Field(s) "' . implode(', ', $diff) . '" does not exists in table "' . $this->name . '"');
    }
74205
public function getFieldTypes()
    {
        return array_map(function ($value) {
            $class_name = class_basename($value);

            return ucfirst(strtolower(preg_replace('/\B([A-Z])/', ' $1', $class_name)));
        }, $this->getRegistrar()->getRegisteredFields());
    }
867019
public static function getExtraFields(){
        return array_map(function($field){
            $extra = [
                'id' => $field['id'],
                'label' => $field['label'],
                'filterable' => array_key_exists('filterable', $field) ? $field['filterable'] : false,
            ];
            if (array_key_exists('columnPosition', $field)) {
                $extra['columnPosition'] = $field['columnPosition'];
            }
            return $extra;
        }, self::_getUserExtraFields());
    }
1157888
public function get_diff()
	{
		$diff = array(0 => array(), 1 => array());
		foreach ($this->_data as $key => $val)
		{
			if ($this->is_changed($key))
			{
				$diff[0][$key] = array_key_exists($key, $this->_original) ? $this->_original[$key] : null;
				$diff[1][$key] = $val;
			}
		}
		foreach ($this->_data_relations as $key => $val)
		{
			$rel = static::relations($key);
			if ($rel->singular)
			{
				$new_pk = null;
				if (empty($this->_original_relations[$key]) !== empty($val)
					or ( ! empty($this->_original_relations[$key]) and ! empty($val)
						and $this->_original_relations[$key] !== $new_pk = $val->implode_pk($val)
					))
				{
					$diff[0][$key] = isset($this->_original_relations[$key]) ? $this->_original_relations[$key] : null;
					$diff[1][$key] = isset($val) ? $new_pk : null;
				}
			}
			else
			{
				$original_pks = empty($this->_original_relations[$key]) ? array() : $this->_original_relations[$key];
				$new_pks = array();
				if ($val)
				{
					foreach ($val as $v)
					{
						if ( ! in_array(($new_pk = $v->implode_pk($v)), $original_pks))
						{
							$new_pks[] = $new_pk;
						}
						else
						{
							$original_pks = array_diff($original_pks, array($new_pk));
						}
					}
				}
				if ( ! empty($original_pks) or ! empty($new_pks)) {
					$diff[0][$key] = empty($original_pks) ? null : $original_pks;
					$diff[1][$key] = empty($new_pks) ? null : $new_pks;
				}
			}
		}

		return $diff;
	}
833811
public function changedFieldNames()
    {
        $diffed = clone $this->fromRecord;
        $fields = array_keys($diffed->toMap());

        $changedFields = [];

        foreach ($fields as $field) {
            if (in_array($field, $this->ignoredFields)) {
                continue;
            }
            if ($this->fromRecord->$field != $this->toRecord->$field) {
                $changedFields[] = $field;
            }
        }

        return $changedFields;
    }
75983
public function getFieldsWithoutSection()
    {
        $matchedFields = array();
        foreach ($this->fields as $fieldName => $field) {
            if (!isset($field['options']['section']) || $field['options']['section'] === null || $field['options']['section'] === '') {
                $matchedFields[$fieldName] = $field;
            }
        }

        return $matchedFields;
    }
693898
protected function checkFields(){
        return $this->fields = is_array($this->fields) ? $this->getFields($this->fields) :  $this->getFields([$this->fields]);
    }
364868
public function getFieldsInfo($fields)
    {
        $trueFields = $this->daoTransform->getTrueFields($fields);
        return array_diff_key($this->daoConfig->fields, $trueFields);
    }
1066130
public function getDiff()
    {
        $set = $this->getIndexInfo();
        unset($set['_id_1']);

        $present = array();
        $missing = array();

        foreach ($this->config as $index) {
            if ( !isset($index['options']) ) $index['options'] = array();

            $name = $this->generateIndexKeyFromConfig($index);
            if ( isset($set[$name]) ) {
                $present[$name] = $index;
                unset($set[$name]);
            } else {
                $missing[$name] = $index;
            }
        }

        return array(
            'missing' => $missing,
            'present' => $present,
            'unknown' => $set
        );
    }
152969
public function diff($o1, $o2)
    {
        $diff = array();

        foreach ($this->_props as $key=>$prop) {
            if(!$prop->type->equals($o1->get($key), $o2->get($key)))
                $diff []= $key;
        }

        return $diff;
    }
676400
private function diffTableFieldAttributes($field, &$attributes, &$fields)
    {
        // loop throd current column property
        foreach ($fields[$field] as $key => $value) {
            // if have a difference
            if ($attributes[$key] == $value) {
                continue;
            }

            //
            if ($this->isDebug()) {
                //echo '<pre style="background:#E66;color:#000;margin:0 0 1px 0;padding:2px 6px 3px 6px;border:1px solid #000;">';
                //echo '  difference: "'.$attributes[$key].'" != "'.$value.'" in '.$field.'['.$key.']</pre>';
            }

            return true;
        }

        return false;
    }
1211287
public function getListFieldsDb() {
		$result = [];
		$fieldsInfo = $this->getLocalFieldsInfo();
		$fieldsInfo += $this->getLdapFieldsInfo();
		if (empty($fieldsInfo)) {
			return $result;
		}

		$excludeFields = $this->_getListBindFields();
		$fields = array_keys($fieldsInfo);
		$result = array_values(array_diff($fields, array_keys($excludeFields)));

		return $result;
	}
645847
protected function getDefaultFields(): array
    {
        $result = [];
        $types = Options::getBasicSearchFieldTypes();

        foreach ($this->searchFields as $field => $properties) {
            if (in_array($properties['type'], $types)) {
                $result[] = $field;
            }
        }

        return $result;
    }
1139916
public function getFieldsUsed(): array
    {
        $fields = [];

        /** @var Field $node */
        foreach ($this->getNodesOfType(Field::NODE_TYPE) as $node) {
            $fields[$node->getName()] = true;
        }

        return array_keys($fields);
    }
502035
public function getActualFields()
    {
        if ($this->actual_fields === false) {
            $this->actual_fields = $this->getGroupField();
        }

        return $this->actual_fields;
    }