Check link and if ID is diferent
@param  [type] $link [description]
@param  [type] $id   [description]
@return [type]       [description]
189718
function checkLink($link, $id)
    {
        $result = $this->db->query('SELECT link 
                                      FROM '.$this->articleTable.' 
                                      WHERE link = :link 
                                      AND id != :id',

                              [':link'=>$link,
                               ':id'=>0+$id]);
        if (isset($result[0])) {
            return $result[0]->get('link');
        }
        
            $this->db->query('UPDATE '.$this->articleTable.'
                            SET link = :link
                            WHERE id = :id',

                    [':link'=>$link,
                     ':id'=>0+$id]);
            return false;
    }
288694
private static function checkLink(Dicionario $d, Meta $m)
    {
        if ($m->getKey() === "link") {
            if (!empty($d->getRelevant()->getValue()))
                $m->setValue(Check::name($d->getRelevant()->getValue()));
        }
    }
1027426
public function add_link(string $id_option, string $id_link): ?string
  {
    $id = $this->db->select_one($this->class_cfg['table'], $this->fields['id'], [
      $this->fields['id_user'] => $this->id_user,
      $this->fields['id_option'] => $id_option
    ]);
    if ( $id ){
      if ( $this->db->update($this->class_cfg['table'], [
        $this->fields['id_link'] => $id_link
      ], ['id' => $id]) ){
        return $id;
      }
    }
    else if ( $this->db->insert($this->class_cfg['table'], [
      $this->fields['id_user'] => $this->id_user,
      $this->fields['id_option'] => $id_option,
      $this->fields['id_link'] => $id_link
    ]) ){
      return $this->db->last_id();
    }
    return null;
  }
312904
function addLink($id, $linkType = 'Entry', $languageKey = null) {
        if (!$languageKey) {
            $languageKey = $this->language;
        }
        $this->link[$languageKey] = ['sys' => [
            'type' => 'Link',
            'linkType' => $linkType,
            'id' => $id
        ]
        ];
        return $this;
    }
824732
public function where_id_is($id)
        {
            return (Arrays::is($this->_getIdColumnName())) ?
                $this->where($this->_getCompoundIdColumnValues($id), null) :
                $this->where($this->_getIdColumnName(), $id);
        }
604134
public function updateLink($id, array $attributes): bool
	{
		$success = true;

		$foreignKey = $this->getForeignKey();

		$foreignKeyValue = $this->parent->getPrimaryKeyValue();

		$junctionKey = $this->getJunctionKey();

		foreach($this->getJunctionKeys($id) as $key => $id)
		{
			$success = $success && (bool) $this->junction()->where($foreignKey, '=', $foreignKeyValue)->where($junctionKey, '=', $id)->update($this->getJunctionAttributes($key, $attributes));
		}

		return $success;
	}
125159
static function get_instance_by_id( $id ) {
            return isset ( self::$_instances[ 'm_' . $id ] ) ?
                self::$_instances[ 'm_' . $id ] :
                false;
        }
212931
public function actionClick($id) 
	{
		$model=$this->loadModel($id);
		if($id == null || $model == null)
			$this->redirect(Yii::app()->createUrl('site/index'));
		else {
			BannerClicks::insertClick($model->banner_id);
			$this->redirect($model->url);
		}
	}
1369879
private function validateForumId($id)
    {
        try {
            $forum = Forum::where('id', $id)->firstOrFail();
            return $forum;
        } catch (\Exception $e) {
            return false;
        }
    }
465240
public function getPluginById($id)
    {
        foreach ($this->plugins as $plugin) {
            if ($plugin::getPluginId() == $id) {
                return $plugin;
            }
        }
    }
905932
public function actionExists($id)
    {
        $inlineActionMethodName = 'action' . Inflector::camelize($id);
        if (method_exists($this->controller, $inlineActionMethodName)) {
            return true;
        }
        if (array_key_exists($id, $this->controller->actions())) {
            return true;
        }
        return false;
    }
1142143
protected function isUnique($id, $url)
    {
        try {
            return $this->loadByUrl($url)->id === $id;
        } catch (NotFoundException $e) {
            return true;
        }
    }
406897
public function assertSeeLink($link)
    {
        if ($this->resolver->prefix) {
            $message = "Did not see expected link [{$link}] within [{$this->resolver->prefix}].";
        } else {
            $message = "Did not see expected link [{$link}].";
        }

        PHPUnit::assertTrue(
            $this->seeLink($link),
            $message
        );

        return $this;
    }
206186
public function findLink($id = null, array $relations = array())
    {
        return new Accessor\LinkAccessor($id, $relations, $this->con);
    }
207613
public function hasLink( $link, &$linkDetail = null )
    {

        $links = $this->__get('links');

        if( isset($links[$link])) {
            $linkDetail = $links[$link];
            return $link;
        }

        foreach( $links as $via => $linkDetail ){
            if( in_array( $link, $linkDetail->foreignEntities ) ) {
                return $via;
            }
        }

        return false;

    }
1086592
public function hasLink(Link $compared)
    {
        foreach ($this->links as $link) {
            if ($this->linksMatch($link, $compared)) {
                return true;
            }
        }

        return false;
    }
1310110
private function _get_links(string $id_link, string $id_user = null, string $id_group = null): ?array
  {
    if ( $id_link = $this->_get_id_option($id_link) ){
      $where = [
        'logic' => 'AND',
        'conditions' => [
          [
            'field' => $this->fields['id_link'],
            'operator' => '=',
            'value' => $id_link
          ]
        ]
      ];
      if ( null !== $id_user ){
        $cond[$this->fields['id_user']] = $id_user;
      }
      if ( null !== $id_group ){
        $cond[$this->fields['id_group']] = $id_group;
      }
      // Not specific
      if ( (null === $id_user) && (null === $id_group) ){
        $cond[$this->fields['public']] = 1;
      }
      $where['conditions'][] = [
        'logic' => 'OR',
        'conditions' => $cond
      ];
      return $this->db->rselect_all([
        'tables' => [$this->class_cfg['table']],
        'fields' => [$this->fields['id'], $this->fields['id_option']],
        'where' => $where,
        'order' => [$this->fields['text']]
      ]);
    }
    return null;
  }