Override is dirty so we can trigger update if we have dirty images.
@return array
971196
public function getDirty()
    {
        $dirty = parent::getDirty();
        if (! empty($this->files)) {
            // We just set the ID to the same value to trigger the update.
            $dirty[$this->getKeyName()] = $this->getKey();
        }

        return $dirty;
    }
1162262
public function actionCleanupImageTable()
    {
        $rows = Yii::$app->db->createCommand('SELECT file_id, filter_id, COUNT(*) as count FROM {{%admin_storage_image}} GROUP BY file_id, filter_id HAVING COUNT(*) > 1')->queryAll();
        
        if (empty($rows)) {
            return $this->outputInfo("no dublications has been detected.");
        }
        
        $this->outputInfo("dublicated image files detected:");
        foreach ($rows as $row) {
            $this->output("> file {$row['file_id']} with filter {$row['filter_id']} found {$row['count']} duplicates.");
        }

        if ($this->confirm("Do you want to delte the duplicated files in the image storage table?")) {
            foreach ($rows as $key => $row) {
                // get the lowest entrie
                $keep = Yii::$app->db->createCommand('SELECT id FROM {{%admin_storage_image}} WHERE file_id=:fileId AND filter_id=:filterId ORDER BY id LIMIT 1', [
                    ':fileId' => $row['file_id'],
                    ':filterId' => $row['filter_id'],
                ])->queryOne();
            
                if (!$keep) {
                    $this->outputError('Unable to find the first row for this delete request. Skip this one');
                    continue;
                }
                
                $remove = Yii::$app->db->createCommand()->delete('{{%admin_storage_image}}', 'file_id=:fileId AND filter_id=:filterId AND id!=:id', [
                    ':fileId' => $row['file_id'],
                    ':filterId' => $row['filter_id'],
                    ':id' => $keep['id'],
                ])->execute();
                
                if ($remove) {
                    $this->outputSuccess("< Remove {$row['count']} duplications for file {$row['file_id']} with filter {$row['filter_id']}.");
                }
            }
        }
        
        return $this->outputSuccess("all duplications has been removed.");
    }
1067928
public function getChangedFields() {
        if($this->isAfterSave() && method_exists($this->getEntity(), 'getUpdatedFields')) {
            if($this->getEntity()->hasSnapshotData()) {
                $actualChangedFields = $this->getEntity()->getUpdatedFields();
            } else {
                $actualChangedFields = $this->getSnapshotData();
            }
        } else { //Legacy
            $actualChangedFields = $this->getEntity()->getChangedFields();
        }
        $model = $this->getEntity();
        foreach($actualChangedFields as $index => $changedField) {
            $newValue = $model->readAttribute($changedField);
            if(is_array($newValue)) {
                $newValue = json_encode($newValue);
            }
            $oldValue = $this->getSnapshotData()[$changedField] ?? null ?? null;
            if(is_object($oldValue)) {
                $oldValue = (string)$oldValue;
            }
            if(is_object($newValue)) {
                $newValue = (string)$newValue;
            }
            if(is_bool($oldValue) || is_bool($newValue)){
                $oldValue = (bool) $oldValue;
                $newValue = (bool) $newValue;
            }
            if($oldValue === $newValue) {
                unset($actualChangedFields[$index]);
            }

        }
        return array_values($actualChangedFields);
    }
1367780
public function getDirty()
	{
		// Kinvey needs all of the model's attributes for update operations
		// see (http://devcenter.kinvey.com/rest/guides/datastore#Saving).

		$dirty = $this->attributes;

		if (array_key_exists(static::UPDATED_AT, $dirty)) unset($dirty[static::UPDATED_AT]);

		return $dirty;
	}
634942
protected function validateImageStyle()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->image_style->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('Image style'));
            return false;
        }

        $this->setSubmitted('update', $data);
        return true;
    }
1062871
public function getDirty()
    {
        $dirty    = [];
        $original = $this->getCastedOriginal();

        foreach ($this->attributes as $key => $value) {
            if ($this->hasCast($key, $value)) {
                $value = $this->castAttribute($key, $value);
            }

            if (
                ! array_key_exists($key, $original) ||
                ($value !== $original[$key] && ! $this->originalIsNumericallyEquivalent($key))
            ) {
                $dirty[$key] = $value;
            }
        }

        return $dirty;
    }
1138657
public function clean()
    {
        $this->removedTags = array();
        $elem = $this->getRealElement();
        if (is_null($elem)) {
            return array();
        }
        $this->cleanNodes($elem, true);
        return $this->removedTags;
    }
1312940
public function getDirtyRelations()
    {
        $dirtyRelations = [];
        foreach ($this->_relations as $relationName) {
            if (array_key_exists($relationName, $this->_oldRelationValue)) {
                $dirtyRelations[$relationName] = $this->owner->{$relationName};
            }
        }
        return $dirtyRelations;
    }
1173084
public function getDirtyColumns()
    {
        $ret = array_keys($this->_cleanData);
        foreach ($this->_getSiblingRows() as $r) {
            $ret = array_merge($ret, $r->getDirtyColumns());
        }
        return $ret;
    }
820151
public function getDirty()
    {
        $dirty = [];
        foreach ($this->getCurrent() as $key => $value) {

            // Value is a default value and `no_saving_default_values` option has been enabled
            if (array_key_exists('no_saving_default_values', $this->internal_options)
                && $this->internal_options['no_saving_default_values']
                && array_key_exists($key, $this->internal_defaults)
                && $this->internal_defaults[$key] === $value) {
                // Do nothing
            }

            // Existing value has changed
            elseif (array_key_exists($key, $this->internal_original_data)
                && $this->internal_original_data[$key] !== $value) {
                $dirty[$key] = $value;
            }

            // New value that has been assigned
            elseif (!array_key_exists($key, $this->internal_original_data)) {
                $dirty[$key] = $value;
            }
        }

        return $dirty;
    }
933092
public function getAllForInsertUpdate()
    {
        $data = [];
        foreach ($this->_values as $key => $value) {
            if ($key === '_id' || $key === '_rev') {
                continue;
            }

            if ($key === '_key' && $value === null) {
                // key value not yet set
                continue;
            }
            $data[$key] = $value;
        }
        if ($this->_key !== null) {
            $data['_key'] = $this->_key;
        }

        return $data;
    }
1096365
public function getChangeSet()
    {
        return [
            'attributes'    => $this->filterNotSavedProperties($this->attributes->calculateChangeSet()),
            'embedOne'      => $this->hasOneEmbeds->calculateChangeSet(),
            'embedMany'     => $this->hasManyEmbeds->calculateChangeSet(),
        ];
    }
1026182
public function actionClearAll()
    {
        $caches = $this->findCaches();
        $cachesInfo = [];

        if (empty($caches)) {
            $this->notifyNoCachesFound();
            return ExitCode::OK;
        }

        foreach ($caches as $name => $class) {
            $cachesInfo[] = [
                'name' => $name,
                'class' => $class,
                'is_flushed' => $this->canBeCleared($class) ? $this->app->get($name)->clear() : false,
            ];
        }

        $this->notifyCleared($cachesInfo);
    }
593080
public function getUnchangedAttributes()
    {
        $output = array();

        foreach ($this->attributes as $name => $value) {
            if (!$this->hasChanged($name)) {
                $output[$name] = $value;
            }
        }

        return $output;
    }
61901
protected function validateEditImageStyle()
    {
        $this->setSubmitted('imagestyle');
        $this->setSubmittedBool('status');
        $this->setSubmittedArray('actions');
        $this->setSubmitted('update', $this->data_imagestyle);

        $this->validateComponent('image_style');

        return !$this->hasErrors();
    }
1102857
protected function getDeletedEventAttributes(): array
    {
        $old = [];

        foreach ($this->attributes as $attribute => $value) {
            if ($this->isAttributeAuditable($attribute)) {
                $old[$attribute] = $value;
            }
        }

        return [
            $old,
            [],
        ];
    }
445988
public static function getAllowedFunctions()
    {
        $properties = array(
            static::PROPERTY_DRAG,
            static::PROPERTY_DROP,
            static::PROPERTY_EDIT,
            static::PROPERTY_DELETE,
        );

        $class = get_called_class();

        if ( is_a( $class, __NAMESPACE__ . '\RepresentsTextContentInterface', true ) )
        {
            $properties[] = static::PROPERTY_REPRESENTS_TEXT;
        }

        if ( is_a( $class, __NAMESPACE__ . '\RepresentsImageContentsInterface', true ) )
        {
            $properties[] = static::PROPERTY_REPRESENTS_IMAGES;
        }

        return $properties;
    }