public function batchUpdate($propertyPairs, $fallBackToIteration = false)
    {
        try {
            if ($this instanceof RepositoryCollection) {
                $this->getRepository()->batchCommitUpdatesFromCollection($this, $propertyPairs);
            } else {
                throw new BatchUpdateNotPossibleException();
            }
        } catch (BatchUpdateNotPossibleException $er) {
            if ($fallBackToIteration) {
                foreach ($this as $item) {
                    $item->mergeRawData($propertyPairs);
                    $item->save();
                }
            } else {
                throw $er;
            }
        }
        return $this;
    }
public function batchUpdate($propertyPairs, $fallBackToIteration = false)
    {
        try {
            if ($this instanceof RepositoryCollection) {
                $this->getRepository()->batchCommitUpdatesFromCollection($this, $propertyPairs);
            } else {
                throw new BatchUpdateNotPossibleException();
            }
        } catch (BatchUpdateNotPossibleException $er) {
            if ($fallBackToIteration) {
                foreach ($this as $item) {
                    $item->mergeRawData($propertyPairs);
                    $item->save();
                }
            } else {
                throw $er;
            }
        }
        return $this;
    }
public function batchUpdate ( $ propertyPairs , $ fallBackToIteration = false ) { try { if ( $ this instanceof RepositoryCollection ) { $ this -> getRepository ( ) -> batchCommitUpdatesFromCollection ( $ this , $ propertyPairs ) ; } else { throw new BatchUpdateNotPossibleException ( ) ; } } catch ( BatchUpdateNotPossibleException $ er ) { if ( $ fallBackToIteration ) { foreach ( $ this as $ item ) { $ item -> mergeRawData ( $ propertyPairs ) ; $ item -> save ( ) ; } } else { throw $ er ; } } return $ this ; }
Applies the provided set of property values to all of the models in the collection.

Where repository specific optimisation is available this will be leveraged to run the batch
update at the data source rather than iterating over the items.

@param  array $propertyPairs An associative array of key value pairs to update
@param  bool $fallBackToIteration If the repository can't perform the action directly, perform the update by
iterating over all the models in the collection. You should only pass true
if you know that the collection doesn't meet the criteria for an optimised
update and the iteration of items won't cause problems
@return Collection The original collection returned for chaining
@throws BatchUpdateNotPossibleException Thrown if the repository for the collection can't perform the update,
and $fallBackToIteration is false.
Applies the provided set of property values to all of the models in the collection .