\Gishiki\Core\MVC\ModelActiveRecordInterface

Represent the interface following active record pattern used on objects that are mapped into a database.

Summary

Methods
Constants
__construct()
save()
load()
delete()
getObjectID()
getReferenceID()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

__construct()

__construct(\Gishiki\Database\DatabaseInterface  $connection) 

Create a new object.

Parameters

\Gishiki\Database\DatabaseInterface $connection

the database connection to be used

save()

save() 

Save the object instance to the database.

This function automatically performs create or update, based on data availability within the database.

delete()

delete() 

Delete the object from the database.

Does nothing if the object is not currently stored.

getObjectID()

getObjectID() : integer|null

Return the current object ID, as it is used within the database.

Returns

integer|null —

the current object ID, as it is used within the database, or null if the object is not stored.

getReferenceID()

getReferenceID() : integer

Return the current object ID.

Exactly as getObjectID(), this function also ensure an ID is returned, and if it is not a save() operation will be performed, in order to generate that ID.

Returns

integer —

the current object ID, as it is used within the database