Skip to content

Commit df911d2

Browse files
committed
save method is insertOrUpdate
1 parent 094339a commit df911d2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/PHPFUI/ORM/Record.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ abstract class Record extends DataObject
5050
/**
5151
* Construct a CRUD object
5252
*
53+
* Reads from the database based on the parameters passed to the constructor. No parameters creates an empty object.
54+
*
5355
* ##### Possible $parameter types and values
5456
* - **int** primary key value, will load object values if the primary key value exists
5557
* - **string** primary key value, will load object values if the primary key value exists
56-
* - **array** object will be initialized to these values, but not read from the database
58+
* - **array** record is attempted to be read from database using the values of the fields provided.
5759
* - **null** (default) constructs an empty object
5860
*/
5961
public function __construct(int|array|null|string $parameter = null)
@@ -437,6 +439,14 @@ public function insertOrUpdate() : int | bool
437439
return $this->privateInsert(true);
438440
}
439441

442+
/**
443+
* Save the record, will either update if it exists or insert if not
444+
*/
445+
public function save() : int | bool
446+
{
447+
return $this->privateInsert(true);
448+
}
449+
440450
/**
441451
* @return bool true if loaded from the disk
442452
*/

0 commit comments

Comments
 (0)