@param string $id
@param string $targetId
@param bool   $multi

@return $this

@throws FrozenException
@throws MixedMultiException
328739
public function setAlias(string $id, string $targetId, bool $multi = false): self
    {
        return $this->set($id, new Definition\Reference($targetId), $multi);
    }
540368
private function copySubBlocksTo($sourceId, $targetPrevId, $targetNavItemPageId)
    {
        if ($sourceId) {
            $subBlocks = NavItemPageBlockItem::findAll(['prev_id' => $sourceId]);
            foreach ($subBlocks as $block) {
                $newBlock = new NavItemPageBlockItem();
                $newBlock->attributes = $block->toArray();
                $newBlock->nav_item_page_id = $targetNavItemPageId;
                $newBlock->prev_id = $targetPrevId;
                $newBlock->insert();

                // check for attached sub blocks and start recursion
                $attachedBlocks = NavItemPageBlockItem::findAll(['prev_id' => $block->id]);
                if ($attachedBlocks) {
                    $this->copySubBlocksTo($block->id, $newBlock->id, $targetNavItemPageId);
                }
            }
        }
    }
21860
public function setLazy(string $id, Definition $definition, bool $multi = false): self
    {
        return $this->set($id, new Definition\Lazy($definition), $multi);
    }
93211
function addMultiLink($id, $linkType = 'Entry', $languageKey = null) {
        if (!$languageKey) {
            $languageKey = $this->language;
        }
        $this->links[$languageKey][] = ['sys' => [
                    'type' => 'Link',
                    'linkType' => $linkType,
                    'id' => $id
                ]
        ];
        return $this;
    }
736171
public function updateMultiples($id, $data) {
		// find
		$model = $this->get($id);

		if ($model === null) {
			return new NotFound(['message' => 'Skill not found.']);
		}

		// pass update to internal logic
		try {
			$this->doUpdateMultiples($model, $data);
		} catch (ErrorsException $e) {
			return new NotValid(['errors' => $e->getErrors()]);
		}

		// save and dispatch events
		$this->dispatch(SkillEvent::PRE_MULTIPLES_UPDATE, $model, $data);
		$this->dispatch(SkillEvent::PRE_SAVE, $model, $data);
		$rows = $model->save();
		$this->dispatch(SkillEvent::POST_MULTIPLES_UPDATE, $model, $data);
		$this->dispatch(SkillEvent::POST_SAVE, $model, $data);

		if ($rows > 0) {
			return Updated(['model' => $model]);
		}

		return NotUpdated(['model' => $model]);
	}
727550
private function evaluateTargetGroup(TargetGroupInterface $targetGroup)
    {
        foreach ($targetGroup->getRules() as $targetGroupRule) {
            if ($this->evaluateTargetGroupRule($targetGroupRule)) {
                return true;
            }
        }

        return false;
    }
1342977
public function tryDelete($id = null)
    {
        if (!is_null($id)) {
            $this->tryLoad($id);
        }
        if ($this->loaded()) {
            $this->delete();
        }

        return $this;
    }
1216430
public function byId($id)
    {
        if ($id instanceof \MongoId) {
            $this->expression->where('_id', $id);
        } else {
            try {
                $this->expression->where('_id', new \MongoId($id));
            } catch (\MongoException $e) {
                $this->expression->where('_id', $id);
            }
        }

        return $this;
    }
185068
public function hasOne($id, JSONSimpleStorage $object, $foreignId) {
        // init one filed
        if (!isset($this->one[$id])) {
            $this->one[$id] = [];
        }
        
        // init many field
        if (!isset($object->many[$foreignId])) {
            $object->many[$foreignId] = [];
            $object->many[$foreignId][$this->class] = [];
        } else if (!isset($object->many[$foreignId][$this->class])) {
            $object->many[$foreignId][$this->class] = [];
        }
        
        // set fields
        $this->one[$id][$object->class] = $foreignId;
        if (!in_array($id, $object->many[$foreignId][$this->class])) {
            $object->many[$foreignId][$this->class][] = $id;
        }
        
        // set dirty objects
        self::$dirty[$object->class] = true;
        self::$dirty[$this->class] = true;
    }
392252
public function transferTagAttributeLinks($tagId, $targetTagId)
    {
        $query = $this->handler->createSelectQuery();
        $query
            ->select('*')
            ->from($this->handler->quoteTable('eztags_attribute_link'))
            ->where(
                $query->expr->eq(
                    $this->handler->quoteColumn('keyword_id'),
                    $query->bindValue($tagId, null, PDO::PARAM_INT)
                )
            );

        $statement = $query->prepare();
        $statement->execute();

        $rows = $statement->fetchAll(PDO::FETCH_ASSOC);

        $updateLinkIds = [];
        $deleteLinkIds = [];

        foreach ($rows as $row) {
            $query = $this->handler->createSelectQuery();
            $query
                ->select(
                    $this->handler->quoteColumn('id')
                )
                ->from($this->handler->quoteTable('eztags_attribute_link'))
                ->where(
                    $query->expr->lAnd(
                        $query->expr->eq(
                            $this->handler->quoteColumn('objectattribute_id'),
                            $query->bindValue($row['objectattribute_id'], null, PDO::PARAM_INT)
                        ),
                        $query->expr->eq(
                            $this->handler->quoteColumn('objectattribute_version'),
                            $query->bindValue($row['objectattribute_version'], null, PDO::PARAM_INT)
                        ),
                        $query->expr->eq(
                            $this->handler->quoteColumn('keyword_id'),
                            $query->bindValue($targetTagId, null, PDO::PARAM_INT)
                        )
                    )
                );

            $statement = $query->prepare();
            $statement->execute();

            $targetRows = $statement->fetchAll(PDO::FETCH_ASSOC);

            if (empty($targetRows)) {
                $updateLinkIds[] = $row['id'];
            } else {
                $deleteLinkIds[] = $row['id'];
            }
        }

        if (!empty($deleteLinkIds)) {
            $query = $this->handler->createDeleteQuery();
            $query
                ->deleteFrom($this->handler->quoteTable('eztags_attribute_link'))
                ->where(
                    $query->expr->in(
                        $this->handler->quoteColumn('id'),
                        $deleteLinkIds
                    )
                );

            $query->prepare()->execute();
        }

        if (!empty($updateLinkIds)) {
            $query = $this->handler->createUpdateQuery();
            $query
                ->update($this->handler->quoteTable('eztags_attribute_link'))
                ->set(
                    $this->handler->quoteColumn('keyword_id'),
                    $query->bindValue($targetTagId)
                )->where(
                    $query->expr->in(
                        $this->handler->quoteColumn('id'),
                        $updateLinkIds
                    )
                );

            $query->prepare()->execute();
        }
    }
31985
public function id($id, $like = false)
    {
        /* @var $this ActiveQuery */
        $model = $this->noInitModel;
        return $this->likeCondition($id, $model->idAttribute, $like);
    }
153691
public function checkConnection($SourceID, $TargetID)
    {
        if (isset($this->Data[$SourceID]["Connections"])) {
            foreach ($this->Data[$SourceID]["Connections"] as $ConnectionID) {
                if ($TargetID == $ConnectionID) {
                    return true;
                }
            }
        }
        $this->Data[$SourceID]["Connections"][] = $TargetID;
    }
368883
protected function getTargetNode(ObjectId $targetOID) {
    if ($this->targetNode == null) {
      // load parent node
      $persistenceFacade = $this->getPersistenceFacade();
      $targetNode = $persistenceFacade->load($targetOID);
      $this->targetNode = $targetNode;
    }
    return $this->targetNode;
  }
177788
public function setId($id)
    {
        $this->id = (string)$id;

        if (!$this->isIdValid($this->id)) {
            throw new InvalidIdException($this);
        }

        return $this;
    }
234703
function MultiId(node) {
  this.nodes = Object.create(null);
  this.nodes[node._nid] = node;
  this.length = 1;
  this.firstNode = undefined;
}
332960
public function setSportId($id, $relatedId) {
		// find
		$model = $this->get($id);

		if ($model === null) {
			return new NotFound(['message' => 'Object not found.']);
		}

		// update
		if ($this->doSetSportId($model, $relatedId)) {
			$this->dispatch(ObjectEvent::PRE_SPORT_UPDATE, $model);
			$this->dispatch(ObjectEvent::PRE_SAVE, $model);
			$model->save();
			$this->dispatch(ObjectEvent::POST_SPORT_UPDATE, $model);
			$this->dispatch(ObjectEvent::POST_SAVE, $model);

			return Updated(['model' => $model]);
		}

		return NotUpdated(['model' => $model]);
	}
1305187
public function addTransaction(int $id, StoreRequest $request)
    {
        /** @var HasTransactionsInterface $object */
        if(!$object = $this->repository->find($id)) {
            abort(404);
        }

        $transaction = $object->addTransaction( $request->all() );

        event(new MadeTransaction($transaction));

        \Cache::tags('response')->flush();

        return new TransactionResource($transaction);
    }