Do not use, this collection is immutable.
{@inheritdoc}
@throws \LogicException if the collection is not cloned.
491048
public function offsetSet($offset, $value)
    {
        if (!$this->is_clone) {
            throw new \LogicException('This collection is immutable');
        }

        $this->collection->offsetSet($offset, $value);
    }
1205350
public function unserialize($value) : void
    {
        if (isset($this->value)) {
            throw new \LogicException('unserialize() is an internal function, it must not be called directly.');
        }

        [$value, $scale] = \explode(':', $value);

        $this->value = $value;
        $this->scale = (int) $scale;
    }
221593
public function unserialize($value) : void
    {
        if (isset($this->numerator)) {
            throw new \LogicException('unserialize() is an internal function, it must not be called directly.');
        }

        [$numerator, $denominator] = \explode('/', $value);

        $this->numerator   = BigInteger::of($numerator);
        $this->denominator = BigInteger::of($denominator);
    }
902635
public function renameTable($oldTableName, $newTableName)
    {
        if (!$this->hasTable($oldTableName)) {
            throw new LogicException('Table ' . $oldTableName . ' does not exist.');
        }

        return $this->query("ALTER TABLE \"$oldTableName\" RENAME \"$newTableName\"");
    }
362111
public function nextList()
    {
        if (!$this->hasNext()) {
            return false;
        }

        if (!isset($this->dataObjectFactory)) {
            throw new \LogicException('setDataObjectFactory must be called before calling nextList.');
        }

        if (!isset($this->objectListQuery)) {
            throw new \LogicException('setByFields must be called before calling nextList.');
        }

        $byFields = clone $this->objectListQuery;
        $range = Range::nextRange($this);
        $byFields->setRange($range);

        return $this->dataObjectFactory->selectRequest($byFields);
    }
1205522
public function resolve()
    {
        if (!$this->cached) {
            if (!($prev = $this->handler)) {
                throw new \LogicException('No handler has been specified');
            }

            foreach (array_reverse($this->stack) as $fn) {
                $prev = $fn[0]($prev);
            }

            $this->cached = $prev;
        }

        return $this->cached;
    }
30764
public function untick()
    {
        if ('checkbox' !== $this->type) {
            throw new \LogicException(sprintf('You cannot tick "%s" as it is not a checkbox (%s).', $this->name, $this->type));
        }

        $this->setValue(false);
    }
120350
public function CloneInstance()
	{
		$result = new InstanceFactsIterator( $this->context );
		$result->nonNilOnly = $this->nonNilOnly;
		$result->iterator = $this->iterator->CloneInstance();
		$result->substitutionGroups = $this->substitutionGroups;
		$result->Reset();
		return $result;
	}
167315
public function duplicateCollection()
    {
        $app = Application::getFacadeApplication();
        $cloner = $app->make(Cloner::class);
        $clonerOptions = $app->build(ClonerOptions::class)->setKeepOriginalAuthor(true);
        $newCollection = $cloner->cloneCollection($this, $clonerOptions);

        return $newCollection;
    }
462025
public function mergeWith(Collection $collection): Collection
    {
        $calledClass = get_called_class();

        if ($collection instanceof $calledClass) {
            foreach ($collection as $key => $object) {
                $this[$key] = $object;
            }
        } else {
            throw new \InvalidArgumentException(sprintf('%s::mergeWith() method require an same type of Collection.', get_class($this)));
        }

        return $this;
    }
1180155
public function duplicate($blocks, $owner = null)
    {
        if ($blocks instanceof BlockInterface) {
            $blocks = array($blocks);
        }

        $iterator = new \RecursiveIteratorIterator(
            new RecursiveBlockIterator($blocks),
            \RecursiveIteratorIterator::SELF_FIRST
        );

        $originalIdMap = array();
        $originalParentMap = array();

        $clones = array();

        // iterate over all owned blocks and disconnect parents keeping ids
        /** @var Block $block */
        foreach ($iterator as $block) {
            $blockId = $block->getId();
            $parentId = false;

            if (in_array($block->getId(), $originalIdMap)) {
                continue;
            }

            $clone = clone $block;
            $clone->setId(null);
            $clone->setParent(null);
            $clone->setOwner($owner);

            // if it has a parent we need to keep the id as reference for later
            if ($block->getParent()) {
                $parentId = $block->getParent()->getId();
            }

            if ($clone instanceof BlockContainerInterface) {
                $clone->setChildren(null);
            }

            $this->em->persist($clone);
            $this->em->flush($clone); // the block gets a new id

            $originalIdMap[$clone->getId()] = $blockId;
            if ($parentId) {
                $originalParentMap[$clone->getId()] = $parentId;
            }

            $clones[] = $clone;
        }

        // iterate over all new blocks and reset their parents
        foreach ($clones as $clone) {
            if (isset($originalParentMap[$clone->getId()])) {
                foreach ($clones as $parent) {
                    if (isset($originalParentMap[$clone->getId()]) &&
                        $originalParentMap[$clone->getId()] === $originalIdMap[$parent->getId()]) {
                        $clone->setParent($parent);
                        $parent->addChild($clone);

                        $this->em->flush($clone);
                        $this->em->flush($parent);
                    }
                }
            }
        }

        return $clones;
    }
1162174
public function update()
    {
        if( !$this->tableName ) {
            throw new LogicException('No table name specified');
        }
        return $this->database->update()
                ->table($this->tableName);
    }
54586
public function delete()
    {
        if( !$this->tableName ) {
            throw new LogicException('No table name specified');
        }
        return $this->database->delete()
                ->table($this->tableName);
    }
58148
function copy( $collectionItemID )
    {
        $item = clone $this;
        $item->setAttribute( 'item_id', $collectionItemID );
        $item->store();
        return $item;
    }
646329
public function commit()
    {
        // Throws a nice exception if no token
        $this->getToken();

        if (!$this->layout instanceof Layout) {
            throw new \LogicException("No contextual instance is set, cannot commit");
        }

        // This gets the temporary storage until now
        $this->getStorage()->delete($this->layout->getId());
        // Loaded instance is supposed to be the false one
        $this->storage->save($this->layout);

        $this->setToken(null);

        return $this;
    }
789189
public function remove() {
		$p = $this->getParent();
		if (null == $p) {
			throw new LogicException();
		}
		$p->removeChildAt( $this->getChildIndex() );
		return $this;
	}
950823
private function persistRecord(array $data, array $fillable = array(), $set)
    {
        if (!empty($fillable) && !ArrayUtils::keysExist($data, $fillable)) {
            throw new LogicException('Can not persist the entity due to fillable protection. Make sure all fillable keys exist in the entity');
        }

        $this->validateShortcutData();

        if (isset($data[$this->getPk()]) && $data[$this->getPk()]) {
            $result = $this->db->update(static::getTableName(), $data)
                               ->whereEquals($this->getPk(), $data[$this->getPk()])
                               ->execute();

            return $set === true ? $data : $result;

        } else {
            // Do not insert primary key if present
            if (array_key_exists($this->getPk(), $data)) {
                unset($data[$this->getPk()]);
            }

            // Insert a new row without PK
            $result = $this->db->insert(static::getTableName(), $data)
                               ->execute();

            if ($set === true) {
                // Append a PK in result-set now
                $data[$this->getPk()] = $this->getMaxId();
                return $data;
            } else {
                return $result;
            }
        }
    }