Saving and Deleting Objects
The C, U and D in CRUD is handled by the code generated save() and delete() methods in every object.
delete() should hopefully be self-explanatory. save() will either call a SQL INSERT or a SQL UPDATE, depending on whether the object was created brand new or if it was restored via one of the load* methods. If you have the need, you can call save() passing in true for the optional $blnForceInsert or $blnForceUpdate parameters to force it to do an INSERT or UPDATE.Load a Person object, modify it, and save
Before the save
- Person ID: 3
- First Name: Ben
- Last Name: Robinson
After the save
- Person ID: 3
- First Name: FooBar
- Last Name: Robinson
Cleaning up
- Person ID: 3
- First Name: Ben
- Last Name: Robinson