src/UthandoCommon/Model/AbstractCollection.php
public function offsetSet($key, $entity)
    {
        $class = $this->entityClass;

        if ($entity instanceof $class) {
            if (!isset($key)) {
                $this->entities[] = $entity;
            } else {
                $this->entities[$key] = $entity;
            }
            return true;
        }

        throw new CollectionException(
            'The specified entity is not allowed for this collection.'
        );
    }
public function offsetSet($key, $entity)
    {
        $class = $this->entityClass;

        if ($entity instanceof $class) {
            if (!isset($key)) {
                $this->entities[] = $entity;
            } else {
                $this->entities[$key] = $entity;
            }
            return true;
        }

        throw new CollectionException(
            'The specified entity is not allowed for this collection.'
        );
    }
public function offsetSet ( $ key , $ entity ) { $ class = $ this -> entityClass ; if ( $ entity instanceof $ class ) { if ( ! isset ( $ key ) ) { $ this -> entities [ ] = $ entity ; } else { $ this -> entities [ $ key ] = $ entity ; } return true ; } throw new CollectionException ( 'The specified entity is not allowed for this collection.' ) ; }
Add an entity to the collection

@param mixed $key
@param mixed $entity
@return bool|void
@throws CollectionException
Add an entity to the collection