Generates IDs based on the PDO::lastInsertId method.
It is recommended to use auto_increment id columns for databases supporting it. This includes MySQL and SQLite. Other databases need to create a sequence per table.
auto_increment databases:
Source for this file: /PersistentObject/src/generators/native_generator.php
ezcPersistentIdentifierGenerator | --ezcPersistentNativeGenerator
Version: | //autogen// |
public int |
postSave(
$def
, $db
)
Returns the integer value of the generated identifier for the new object. |
public void |
preSave(
$def
, $db
, $q
)
No functionality, since database handles ID generation automatically. |
From ezcPersistentIdentifierGenerator | |
---|---|
public bool |
ezcPersistentIdentifierGenerator::checkPersistence()
Returns true if the object is persistent already. |
public abstract int |
ezcPersistentIdentifierGenerator::postSave()
Returns the value of the generated identifier for the new object. |
public abstract void |
ezcPersistentIdentifierGenerator::preSave()
Called prior to executing the insert query that saves the data to the database. |
Returns the integer value of the generated identifier for the new object.
Called right after execution of the insert query.
Name | Type | Description |
---|---|---|
$def |
ezcPersistentObjectDefinition | |
$db |
ezcDbHandler |
Method | Description |
---|---|
ezcPersistentIdentifierGenerator::postSave() |
Returns the value of the generated identifier for the new object. |
No functionality, since database handles ID generation automatically.
Name | Type | Description |
---|---|---|
$def |
ezcPersistentObjectDefinition | |
$db |
ezcDbHandler | |
$q |
ezcQueryInsert |
Method | Description |
---|---|
ezcPersistentIdentifierGenerator::preSave() |
Called prior to executing the insert query that saves the data to the database. |