lithium\data\collection\DocumentArray::offsetSet PHP Method

offsetSet() public method

public offsetSet ( $offset, $data )
    public function offsetSet($offset, $data)
    {
        if ($model = $this->_model) {
            $data = $model::connection()->cast($model, array($this->_pathKey => $data), array('first' => true));
        }
        if ($offset) {
            return $this->_data[$offset] = $data;
        }
        return $this->_data[] = $data;
    }