NextDom\Helpers\DBHelper
Class DBHelper
Synopsis
class DBHelper
{
- // constants
- const FETCH_TYPE_ROW = 0;
- const FETCH_TYPE_ALL = 1;
- const CONNECTION_TIMEOUT = 120;
- // members
- private static $sharedInstance;
- private static array $fieldsCache = ;
- private static array $fieldsQuery = ;
- private $connection;
- private $lastConnection;
- // methods
- private void __construct()
- public static array|mixed|null CallStoredProc()
- public static array|mixed|null Prepare()
- public static PDO getConnection()
- public static mixed|null getAllObjects()
- public static void optimize()
- public static mixed getAll()
- public static bool exec()
- public static void beginTransaction()
- public static void commit()
- public static void rollBack()
- public static boolean save()
- private static mixed getField()
- private static ReflectionClass getReflectionClass()
- private static array getFields()
- private static string getTableName()
- private static void setField()
- private static array buildQuery()
- public static mixed getOne()
- public static mixed getLastInsertId()
- public static bool refresh()
- public static string buildField()
- public static mixed|null getOneObject()
- public static array getWithFilter()
- public static boolean remove()
- public static mixed checksum()
- public static boolean lock()
- public static bool compareAndFix()
- private static array compareDatabase()
- private static array compareTable()
- private static string buildDefinitionField()
- private static string buildDefinitionIndex()
- private static array compareField()
- private static array prepareIndexCompare()
- private static array compareIndex()
- public void __clone()
- public array getAllNextDomTables()
Tasks
Line | Task |
---|---|
80+ | : Y en a-t-il d'utilisé ? |
132 | Revoir cette chaine |
481+ | : ???? Ca me parait dangereux si il y a une écriture en bdd entre temps |
Constants
Name | Value |
---|---|
FETCH_TYPE_ROW | 0 |
FETCH_TYPE_ALL | 1 |
CONNECTION_TIMEOUT | 120 |
Members
private
- $connection
- $fieldsCache
- $fieldsQuery
- $lastConnection
Methods
private
- __construct() — Private constructor for singleton
- buildDefinitionField()
- buildDefinitionIndex()
- buildQuery() — Builds the elements for an SQL query. It will return two lists, the first being the list of parts "key= :key" to inject in the SQL, the second being the mapping of these parameters to the values.
- compareDatabase()
- compareField()
- compareIndex()
- compareTable()
- getField() — Returns the value of a field of a given object. It'll try to use a getter first if defined. If not defined, we'll use the reflection API.
- getFields()
- getReflectionClass() — Returns the reflection class for the given object.
- getTableName() — Returns the name of the table where to save entities.
- prepareIndexCompare()
- setField() — Forces the value of a field of a given object, even if this field is not accessible.
public
- CallStoredProc() — Call procedure
- Prepare() — Prepare a query and execute
- __clone() — Block object cloning
- beginTransaction() — Begin transaction
- buildField() — Build fields for query
- checksum()
- commit() — Commit transaction
- compareAndFix()
- exec() — Execute a query without result (DELETE, UPDATE, INSERT, etc.)
- getAll() — Get data from database
- getAllNextDomTables() — Return all tables in NextDom database
- getAllObjects() — Get objects from database
- getConnection() — Get the connection. Connect to the database if not.
- getLastInsertId() — Get the last insert id
- getOne() — Get one row data from database
- getOneObject() — Get one object from database
- getWithFilter() — Get list of objects filtered
- lock() — Lock an entity.
- optimize() — Optimize all tables
- refresh() — Refresh value of an object
- remove() — Deletes an object.
- rollBack() — Rollback a transaction
- save() — Saves an entity inside the repository. If the entity is new a new row will be created. If the entity is not new the row will be updated.