Inserts relation data to config file
@param string $from Local table
@param string $to Related table
765510
protected function deleteRelationData($from, $to)
    {
        $config  = Config::table($from);
        $content = $config->get();
        unset($content->relations->{$to});
        $config->put($content);
    }
740275
static function link_object_to($from, $to, $params = [])
	{
		$data = [
			'from_class'=> $from->extends_class_id(),
			'from_id'	=> $from->id(),
			'to_class'	=> $to->extends_class_id(),
			'to_id'		=> $to->id(),
		];

		$link = bors_find_first('bors_link', $data);
		if($link)
		{
			$link->set_sort_order(defval($params, 'sort_order', 0));
			foreach($params as $k => $v)
				$link->set($k, $v, true);

			$link->set_target($to);
			$link->store();

			return false;
		}

		if(empty($params['owner_id']))
			$params['owner_id'] = bors()->user_id();

		$data['sort_order'] = defval($params, 'sort_order', 0);
		foreach($params as $k => $v)
			$data[$k] = $v;

		self::set_target_array($data, $to);

		$link = bors_new('bors_link', $data);

		if(method_exists($to, 'set_parent_object') && !$to->parent_object())
			$to->set_parent_object($from);

		echo "\nnew link {$from} => {$to}\n";

		$link->store();

		return true;
	}
447798
public function registerFile($type, $from, $to)
	{
		if (!isset($this->registered_files[$type]))
			$this->registered_files[$type] = array();

		$this->registered_files[$type][$from] = $to;
	}
80929
function copyAsUser($from, $to)
    {
        copy($from, $to);

        $this->chown($to, user());
    }
1044440
public function memberCardSummaryById(string $from, string $to, string $cardId)
    {
        $ext = [
            'card_id' => $cardId,
        ];

        return $this->query('datacube/getcardmembercarddetail', $from, $to, $ext);
    }
900943
public function setRelation(Relationship $relation, $debug = false)
    {
        // Set the relation object.
        $this->relation = $relation;

        // Replace the attributes with those brought from the given relation.
        $this->attributes = $relation->getProperties();
        $this->setAttribute($this->primaryKey, $relation->getId());

        // Set the start and end nodes.
        $this->start = $relation->getStartNode();
        $this->end   = $relation->getEndNode();

        // Instantiate and fill out the related model.
        $relatedNode = ($this->isDirectionOut()) ? $this->end : $this->start;
        $attributes = array_merge(['id' => $relatedNode->getId()], $relatedNode->getProperties());

        // This is an existing relationship.
        $this->related = $this->related->newFromBuilder($attributes);
        $this->related->setConnection($this->related->getConnectionName());
    }
730057
public function pack($from, $to)
    {
        if (($gzip = gzopen($to, 'wb')) === false) {
            throw new Exception('Unable create compressed file.');
        }

        if (($source = fopen($from, 'rb')) === false) {
            throw new Exception('Unable open the compression source file.');
        }

        while (!feof($source)) {
            $content = fread($source, 4096);
            gzwrite($gzip, $content, strlen($content));
        }

        gzclose($gzip);
        fclose($source);
    }
468963
public function renameFile( $from, $to )
	{
		$this->connection->checkConnection();
		return @ftp_rename( $this->connection->getResource(), $from, $to );
	}
256329
protected static function _relationsToLoad() {
		try {
			if (!$connection = static::connection()) {
				return;
			}
		} catch (ConfigException $e) {
			return;
		}

		if (!$connection::enabled('relationships')) {
			return;
		}

		$self = static::_object();

		foreach ($self->_relationTypes as $type) {
			$self->$type = Set::normalize($self->$type);
			foreach ($self->$type as $name => $config) {
				$self->_relationsToLoad[$name] = $type;
				$fieldName = $self->_relationFieldName($type, $name);
				$self->_relationFieldNames[$fieldName] = $name;
			}
		}
	}
536129
public function moveFilesWildcard($from, $to)
    {
        coollect(glob($this->dataDir($from)))->each(function ($from) use ($to) {
            $this->mkDir($dir = $this->dataDir($to));

            rename($from, $dir.'/'.basename($from));
        });
    }
365948
public function addFrom($from)
    {
        if (is_array($from)) {
            $this->from = array_merge($this->from, $from);
        } elseif (!empty($from)) {
            $this->from[str_replace(array('"','`'), '', $from)] = $from;
        }

        return $this;
    }
698853
public function cp(array &$array, string $from, string $to): void
    {
        // If $from is not readable
        if (false === $this->pa->isReadable($array, $from)) {
            throw new AccessException(sprintf('The $from path "%s" isn\'t readable.', $from));
        }

        // Get the value to move
        $value = $this->getValue($array, $from);

        // Check if $to is the root and if it is
        if ($this->isRoot($to)) {
            // Merge the value in the passed $array
            $array = array_merge($array, $this->forceArray($value));

            return;
        }

        // Do the copy
        $this->pa->setValue($array, $to, $value);
    }
894198
public function sync(string $from, string $to, array $config = []): void
    {
        $this->syncPlugin->sync($this, $from, $to, $config);
    }
953509
public function replaceMemberAuthor(User $from, User $to)
    {
        $fromIsMember = false;
        $froms = $this->memberRepo->findByUser($from);
        if (count($froms) > 0) {
            $fromIsMember = true;
        }

        $toIsMember = false;
        $tos = $this->memberRepo->findByUser($to);
        if (count($tos) > 0) {
            $toIsMember = true;
        }

        if ($toIsMember && $fromIsMember) {
            //user kept already have its member entry, delete the old one
            foreach ($froms as $member) {
                $this->objectManager->remove($member);
            }
            $this->objectManager->flush();
        } elseif (!$toIsMember && $fromIsMember) {
            //update entry for kept user
            foreach ($froms as $member) {
                $member->setUser($to);
            }
            $this->objectManager->flush();
        }
    }
969399
protected function moveUploadedFile($from, $to)
    {
        return $this->unitTest ? copy($from, $to) : @move_uploaded_file($from, $to);
    }
1124219
public function createLink($from, $to)
    {
        if (File::exists($from)) {
            if (!File::exists($to)) {
                try {
                    symlink($from, $to);
                } catch (\Exception $e) {
                    throw new \Exception("Cannot create symlink from $from to $to");
                }
            }
        }
    }
993846
public function addFrom(string $from): void
    {
        $from = $this->quoteName($from);
        $this->statement .= ' FROM ' . $from . PHP_EOL;
    }