Skip to content
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into allow_json_mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
mathcals committed Nov 3, 2018
2 parents 37ede70 + 1f51c06 commit 9d34afb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/PersistenceModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,14 @@ protected function deleteByPrimaryKey(array $primary_key_values) {
* Updates the model if it exists,
* otherwise creates it.
* @param PersistentEntity $entity
* @return boolean whether a new row was created
* @return int|false last inserted id if new entity is created, false otherwise
*/
public function updateOrCreate(PersistentEntity $entity) {
if ($this->exists($entity)) {
$this->update($entity);
return true;
} else {
$this->create($entity);
return false;
} else {
return $this->create($entity);
}
}

Expand Down

0 comments on commit 9d34afb

Please sign in to comment.