Skip to content

Commit

Permalink
Do not force preventSaving in createCollection()
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhj committed Jun 9, 2019
1 parent 0b5cb4c commit 76062ae
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/Model/Multilingual.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ protected static function buildCountQuery(array $options)
}

/**
* Prevent model from saving when creating a model from a database result
* Prevent model from saving when creating a model from a database result. See #51
*
* @param Result $objResult The database result object
*
Expand All @@ -224,27 +224,7 @@ protected static function createModelFromDbResult(Result $objResult)
}

/**
* Prevent new models from saving when creating a Collection object
*
* @param array $arrModels An array of models
* @param string $strTable The table name
*
* @return Collection The Collection object
*/
protected static function createCollection(array $arrModels, $strTable)
{
$collection = new Collection($arrModels, $strTable);

/** @var self $model */
foreach ($collection as $model) {
$model->preventSaving(false);
}

return $collection->reset();
}

/**
* Prevent new models from saving when creating a new collection from a database result
* Prevent new models from saving when creating a new collection from a database result. See #51
*
* @param Result $objResult The database result object
* @param string $strTable The table name
Expand Down

0 comments on commit 76062ae

Please sign in to comment.