Set the object's unique ID.

The actual property set depends on `key()`.

@param  mixed $id The object's ID.
@throws InvalidArgumentException If the argument is not scalar.
@return self
357480
public function setId($id)
    {
        if (!is_scalar($id)) {
            throw new InvalidArgumentException(sprintf(
                'ID for "%s" must be a scalar (integer, float, string, or boolean); received %s',
                get_class($this),
                (is_object($id) ? get_class($id) : gettype($id))
            ));
        }

        $key = $this->key();
        if ($key === 'id') {
            $this->id = $id;
        } else {
            $this[$key] = $id;
        }

        return $this;
    }
1066227
public function set_last_insert_id($id=''): self
  {
    if ( $id === '' ){
      if ( $this->id_just_inserted ){
        $id = $this->id_just_inserted;
        $this->id_just_inserted = null;
      }
      else{
        $id = $this->lastInsertId();
        if ( \is_string($id) && str::is_integer($id) ){
          $id = (int)$id;
        }
      }
    }
    else{
      $this->id_just_inserted = $id;
    }
    $this->last_insert_id = $id;
    return $this;
  }
983269
public function setId(int $id): Field
    {
        Assert::greaterThan($id, 0);

        $this->id = $id;

        return $this;
    }
554206
public function get($id)
  {
    if (isset($this->instances[$id])) return $this->instances[$id];
    if (isset($this->callables[$id]))
    {
      $item = call_user_func($this->callables[$id],$this);
      return $this->instances[$id] = $item;
    }
    throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined for get.', $id));
  }
1192266
static public function setActiveId ($id)
    {
        $model = self::find($id);
        if ($model)
        {
            self::$active_model = $model;
        }
    }
502156
public function setId($id = null)
    {
        if ($id !== null) {
            $id = preg_replace("/[^a-z0-9_\\\d]/i", '_', $id);

            $this->id = (string) $id;
        }
    }
888539
public function setCustomerId($id)
    {
        if (!isset($this->data->customer)) {
            $this->data->customer = new stdClass();
        }
        $this->data->customer->id = $id;

        return $this;
    }
259195
public function setId($id = null) {

        if (
            $id === null ||
            is_bool($id) ||
            ( is_int($id) && $id > 0 ) ||
            ( is_string($id) && !empty($id) )
        ) {

            $this->id = $id;

        } else {

            throw new InvalidArgumentException("Invalid RPC id");

        }

        return $this;

    }
1296563
public function remove($id) {
    if (empty($id) || !is_numeric($id)) {
      throw new InvalidArgumentException('ID must be numeric');
    }
    return $this->delete('assets/email/' . rawurlencode($id));
  }
448300
public function setID($id)
    {
        $dao = $this->getDAO();
        $pkey = $dao->getPrimaryKey();

        if (count($pkey) === 1 && is_scalar($id))
        {
            $pcol = reset($pkey);
            $this->setField($pcol->getName(), $id);
        }
        elseif (is_array($id) && array_keys($id) === array_keys($pkey))
        {
            foreach ($pkey as $name => $def)
            {
                $this->setField($name, $id[$name]);
            }
            $this->_id = $id;
        }
        else
        {
            throw new InvalidTypeException("Provided ID does not match primary key");
        }
        return $this;
    }
1170627
public function set($key, $value)
    {
        if (!is_scalar($value) && !is_array($value)) {
            $msg = 'Value has to be a scalar or an array, but is '.gettype($value).'.';
            throw new InvalidArgumentException($msg);
        }

        $this->values[$key] = $value;

        return $this;
    }
868640
public function setId(int $id): Phone
    {
        Assert::greaterThan($id, 0);

        $this->id = $id;

        return $this;
    }
920721
public function setBaseId( $id )
	{
		if ( $id == $this->getBaseId() ) { return; }

		$this->_values['baseid'] = (int) $id;
		$this->setModified();
	}
518959
public function setId(string $id = null): ButtonInterface
    {
        if ($this->isVisibility()) {
            $this->id = $id;
        }

        return $this;
    }
1281016
public function delete($id)
    {
        $this->validateId($id);

        $entity = $this->getMapper()->find($id);

        if (null === $entity) {
            throw new \InvalidArgumentException('No entity found for id "' . $id . '"');
        }

        $this->getMapper()->remove($entity);

        return $this;
    }
1064175
public function setDataEntry($id, $key, $value)
    {
        if (!isset($this->data[$id])) {
            throw new InvalidArgumentException("Missing row with ID $id.");
        }
        if (!$this->isDetached and $key === $this->mapper->getPrimaryKey($this->table)) { // mapper is always set when Result is not detached
            throw new InvalidArgumentException("ID can only be set in detached rows.");
        }
        $this->modified[$id][$key] = true;
        $this->data[$id][$key] = $value;
    }
108939
public function setId($id)
    {
        $id = $this->buildId($id);

        if ($this->isRelation($id)) {
            $relations = explode('.', $id);

            $lastElement = array_pop($relations);

            if (!$this->keepOriginalID) {
                $id = $lastElement;
            }

            $this->relations = $relations;
        }

        $this->id = $id;

        return $this;
    }