public function offsetSet($offset, $value)
    {
        if (!$value instanceof Author) {
            throw new InvalidArgumentType(
                '$value',
                'eZ\\Publish\\Core\\FieldType\\Author\\Author',
                $value
            );
        }

        $aAuthors = $this->getArrayCopy();
        parent::offsetSet($offset, $value);
        if (!isset($value->id) || $value->id == -1) {
            if (!empty($aAuthors)) {
                $value->id = end($aAuthors)->id + 1;
            } else {
                $value->id = 1;
            }
        }
    }
public function offsetSet($offset, $value)
    {
        if (!$value instanceof Author) {
            throw new InvalidArgumentType(
                '$value',
                'eZ\\Publish\\Core\\FieldType\\Author\\Author',
                $value
            );
        }

        $aAuthors = $this->getArrayCopy();
        parent::offsetSet($offset, $value);
        if (!isset($value->id) || $value->id == -1) {
            if (!empty($aAuthors)) {
                $value->id = end($aAuthors)->id + 1;
            } else {
                $value->id = 1;
            }
        }
    }
public function offsetSet ( $ offset , $ value ) { if ( ! $ value instanceof Author ) { throw new InvalidArgumentType ( '$value' , 'eZ\\Publish\\Core\\FieldType\\Author\\Author' , $ value ) ; } $ aAuthors = $ this -> getArrayCopy ( ) ; parent :: offsetSet ( $ offset , $ value ) ; if ( ! isset ( $ value -> id ) || $ value -> id == - 1 ) { if ( ! empty ( $ aAuthors ) ) { $ value -> id = end ( $ aAuthors ) -> id + 1 ; } else { $ value -> id = 1 ; } } }
Adds a new author to the collection.

@throws InvalidArgumentType When $value is not of type Author

@param int $offset
@param \eZ\Publish\Core\FieldType\Author\Author $value
Adds a new author to the collection .