Adds the specified object to the `Collection` instance, and assigns associated metadata to the added object.

Parameters

  • string $offset The offset to assign the value to.
  • mixed $data The entity object to add.

Returns

mixed Returns the set `Entity` object.

Source

						public function offsetSet($offset, $data) {
		if (is_array($data) && ($model = $this->_model)) {
			$data = $model::connection()->cast($this, $data);
		} elseif (is_object($data)) {
			$data->assignTo($this);
		}
		return $this->_data[] = $data;
	}