public function set(ItemInterface $item)
    {
        $id = $item->getId();
        $collectionName = $item->getCollection();

        $this->items[$id] = $item;

        if (isset($this->idCollections[$id]) && $this->idCollections[$id] !== $collectionName) {
            throw new \RuntimeException(sprintf('The item with id: "%s" has been registered previously with another collection.', $id));
        }

        if (isset($this->itemCollections[$collectionName]) === false) {
            $this->itemCollections[$collectionName] = [];
        }

        $this->itemCollections[$collectionName][$id] = $item;
        $this->idCollections[$id] = $collectionName;
    }
public function set(ItemInterface $item)
    {
        $id = $item->getId();
        $collectionName = $item->getCollection();

        $this->items[$id] = $item;

        if (isset($this->idCollections[$id]) && $this->idCollections[$id] !== $collectionName) {
            throw new \RuntimeException(sprintf('The item with id: "%s" has been registered previously with another collection.', $id));
        }

        if (isset($this->itemCollections[$collectionName]) === false) {
            $this->itemCollections[$collectionName] = [];
        }

        $this->itemCollections[$collectionName][$id] = $item;
        $this->idCollections[$id] = $collectionName;
    }
public function set ( ItemInterface $ item ) { $ id = $ item -> getId ( ) ; $ collectionName = $ item -> getCollection ( ) ; $ this -> items [ $ id ] = $ item ; if ( isset ( $ this -> idCollections [ $ id ] ) && $ this -> idCollections [ $ id ] !== $ collectionName ) { throw new \ RuntimeException ( sprintf ( 'The item with id: "%s" has been registered previously with another collection.' , $ id ) ) ; } if ( isset ( $ this -> itemCollections [ $ collectionName ] ) === false ) { $ this -> itemCollections [ $ collectionName ] = [ ] ; } $ this -> itemCollections [ $ collectionName ] [ $ id ] = $ item ; $ this -> idCollections [ $ id ] = $ collectionName ; }
Sets an item.

@param Yosymfony\Spress\Core\DataSource\ItemInterface

@throws \RuntimeException If the item has been registered previously in another collection
Sets an item .