Get original values

@param array $input
@param boolean $for_update
181350
private function getOriginalValues($input, $for_update) {
		// process primary key
		$this->full_pk = false;
		$this->loadPk($input);
		// load values if we have full pk
		if ($this->full_pk) {
			$temp = $this->loadValues($for_update);
			if ($temp !== false) {
				$this->original_values = $temp;
				$this->values_loaded = true;
			}
		}
	}
221737
public function execute(array $input) : array {
		$this->form->form_object->addInput($input);
		$this->form->form_object->process();
		return $this->form->form_object->apiResult();
	}
395349
public function prepareList_emailDataForInsert($input) {

        $data = [];

        $data['title']         = $input['listID']." ".$input['emailID'];
        $data['list_id']       = $input['listID'];
        $data['email_id']      = $input['emailID'];
        $data['comments']      = "";
        $data['enabled']       = 1;
        $data['created_at']    = Carbon::now();
        $data['created_by']    = $this->userRepository->getFirstAmongEqualsUserID();
        $data['updated_at']    = Carbon::now();
        $data['updated_by']    = $this->userRepository->getFirstAmongEqualsUserID();

        return $data;

    }
919412
protected function checkValue($input)
    {
        if ('' === $input || !is_array($this->rootNodes)) {
            return;
        }

        if (false === strpos($input, ',')) {
            $ids = [(int) $input];
        } else {
            $ids = array_map('intval', array_filter(explode(',', $input)));
        }

        if (count(array_diff($ids, array_merge($this->rootNodes, Database::getInstance()->getChildRecords($this->rootNodes, 'tl_news_category')))) > 0) {
            $this->addError($GLOBALS['TL_LANG']['ERR']['invalidPages']);
        }
    }
991436
public function postUpdate($input)
	{
		$baseModel = $this->getAdmin()->getModel();
		$baseModel = $baseModel::find($this->getAdmin()->getFormBuilder()->getIdentifier());

		$morphType = $baseModel->{$this->getName()}()->getMorphType();
		$morphType = str_replace(sprintf('%s.', $this->getName()), '', $morphType);

		$foreignKey = $baseModel->{$this->getName()}()->getForeignKey();
		$foreignKey = str_replace(sprintf('%s.', $this->getName()), '', $foreignKey);

		// remove old polymorphic relations
		foreach ($baseModel->{$this->getName()} as $item) {
			$item->update([
				$foreignKey => 0,
				$morphType  => '',
			]);
		}

		// update new item with polymorphic relation
		$baseModel->{$this->getName()}()
			->getRelated()
			->where($items->getKeyName(), $input[$this->getName()])
			->update([
				$foreignKey => $this->getAdmin()->getFormBuilder()->getIdentifier(),
				$morphType  => get_class($baseModel),
			]);
	}
144610
public function temporaryPost(array $input) : array {
		$input[\Object\Form\Parent2::BUTTON_SUBMIT_SAVE] = true;
		$input[\Object\Form\Parent2::BUTTON_SUBMIT_TEMPORARY_POST] = true;
		$this->form->form_object->addInput($input);
		$this->form->form_object->process();
		return $this->form->form_object->apiResult();
	}
560916
public static function allEmpty($input): bool
    {
        if (is_array($input)) {
            foreach ($input as $value) {
                if (!self::allEmpty($value)) {
                    return false;
                }
            }

            return true;
        } else {
            return empty($input);
        }
    }
931521
function Update()
	{
		$db = $this->DB();
		if (!$db) {
			return false;
		}
		$table = $this->TableInfo();

		$where = $this->GenWhere($db, $table);

		if (!$where) {
			$this->error("Where missing for table $table", "Update");
			return false;
		}
		$valarr = array();
		$neworig = array();
		$pairs = array();
		$i = -1;
		$cnt = 0;
		foreach($table->flds as $name=>$fld) {
			$i += 1;
			$val = $this->$name;
			$neworig[] = $val;

			if (isset($table->keys[$name])) {
				continue;
			}

			if (is_null($val)) {
				if (isset($fld->not_null) && $fld->not_null) {
					if (isset($fld->default_value) && strlen($fld->default_value)) {
						continue;
					}
					else {
						$this->Error("Cannot set field $name to NULL","Update");
						return false;
					}
				}
			}

			if (isset($this->_original[$i]) && $val === $this->_original[$i]) {
				continue;
			}
			$valarr[] = $val;
			$pairs[] = $name.'='.$db->Param($cnt);
			$cnt += 1;
		}


		if (!$cnt) {
			return -1;
		}
		$sql = 'UPDATE '.$this->_table." SET ".implode(",",$pairs)." WHERE ".$where;
		$ok = $db->Execute($sql,$valarr);
		if ($ok) {
			$this->_original = $neworig;
			return 1;
		}
		return 0;
	}
1082853
public function update( $id = false, $inputs = [] )
	{
		if( is_numeric($id) )
		{
			$update_inputs = [];
			$values = [];

			foreach( $inputs as $key => $value )
			{
				$update_inputs []= "`$key` = :$key";
				$values[":$key"] = $value;
			}

			$values[":id"] = $id;

			return $this->execute( "UPDATE `{$this->table}` SET " . implode(',',$update_inputs) . " WHERE `id` = :id" , $values );
		}
		return false;
	}
812743
public function update(int $id, array $input)
    {
        return $this->model->find($id)->update($input);
    }
299538
public function match($input)
    {
       
        $noMatch = true;
        foreach ($this->matchers as $matcher) {
            if ($matcher->noMatch()) {
                continue;
            }
            if ($matcher->match($input)) {
                $noMatch = false;
            }
            if ($matcher->matchFound()) {
                $this->matched[] = $matcher->matched;
                $this->resetMatchers();
                break;
            }
        }
        if ($noMatch) {
            return false;
        }
        return true;
    }
199796
private static function isValid($input)
    {
        if (!is_array($input)) {
            return false;
        }
        foreach ($input as $value) {
            if (!is_scalar($value)) {
                return false;
            }
        }

        return true;
    }
1087007
public function getDbValues(array $input = [], $mappings = [])
    {
       $response = [];
       foreach ($mappings as $inputKey => $dbValue) {
            if (is_array($input) && array_get($input, $inputKey) !== null) {
                $value = array_get($input, $inputKey);
                if ($value instanceof UploadedFile) {
                    array_set($response, $dbValue, $value);
                } elseif (is_array($value)) {
                    if (class_exists($mappings[$inputKey]['class'])) {
                        $class = new $mappings[$inputKey]['class']($this->app);
                        foreach ($value as $v) {
                            $response[$mappings[$inputKey]['key']][] = $this->getDbValues($v, $class->mappings());
                        }
                    } else {
                        array_set($response, $dbValue, $value);
                    }
                } else {
                    array_set($response, $dbValue, (is_bool($value) ? $value : trim($value)));
                }
            }
        }
        
        return $response;
    }
535183
public function get(array $input) : array {
		$this->form->form_object->addInput($input);
		$this->form->form_object->process();
		return $this->form->form_object->apiResult();
	}
144402
private function getIdFromInput( $input ) {
		if( is_string( $input ) ) {
			return $input;
		} elseif( $input instanceof ItemId ) {
			return $input->getSerialization();
		} elseif( $input instanceof Item ) {
			return $input->getId()->getSerialization();
		} else {
			throw new InvalidArgumentException( 'Merge target should be either string, Item or ItemId' );
		}
	}
777822
public function update(int $id, array $input)
    {
        $this->cache->tags($this->getModel())->flush();
        return $this->repository->update($id, $input);
    }
200311
public function update(Model $model, array $input)
    {
        $updated = $model->update($input);

        if ($updated) {
            app('cache')->flush();
        }

        return $updated;
    }