src/ORM/UnsavedRelationList.php
public function first()
    {
        $item = reset($this->items);
        if (is_numeric($item)) {
            $item = DataObject::get_by_id($this->dataClass, $item);
        }
        if (!empty($this->extraFields[key($this->items)])) {
            $item->update($this->extraFields[key($this->items)]);
        }
        return $item;
    }
public function first()
    {
        $item = reset($this->items);
        if (is_numeric($item)) {
            $item = DataObject::get_by_id($this->dataClass, $item);
        }
        if (!empty($this->extraFields[key($this->items)])) {
            $item->update($this->extraFields[key($this->items)]);
        }
        return $item;
    }
public function first ( ) { $ item = reset ( $ this -> items ) ; if ( is_numeric ( $ item ) ) { $ item = DataObject :: get_by_id ( $ this -> dataClass , $ item ) ; } if ( ! empty ( $ this -> extraFields [ key ( $ this -> items ) ] ) ) { $ item -> update ( $ this -> extraFields [ key ( $ this -> items ) ] ) ; } return $ item ; }
Returns the first item in the list

@return mixed
Returns the first item in the list