Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
SDAO Class Reference

DAO class for models without relationships Model classes must declare public members only Ubiquity\orm$SDAO This class is part of Ubiquity. More...

+ Inheritance diagram for SDAO:

Static Public Member Functions

static update ($instance, $updateMany=false)
 Updates an existing $instance in the database.
 
- Static Public Member Functions inherited from DAO
static getDb ($model)
 
static getAll ($className, $condition='', $included=true, $parameters=null, $useCache=NULL)
 Returns an array of $className objects from the database.
 
static getAllByIds ($className, $keyValues=[], $included=true, $condition='', $useCache=NULL)
 Returns an array of $className objects loaded by id from the database.
 
static paginate ($className, $page=1, $rowsPerPage=20, $condition=null, $included=true)
 
static orderBy (string $className, string $field, string $order='ASC', string $condition='', bool $included=true, $parameters=null, $useCache=NULL)
 Returns an array of $className objects from the database ordered by $field.
 
static getRownum ($className, $ids)
 
static count ($className, $condition='', $parameters=null)
 Returns the number of objects of $className from the database respecting the condition possibly passed as parameter.
 
static exists ($className, $condition='', $parameters=null)
 Tests the existence of objects of $className from the database respecting the condition possibly passed as parameter.
 
static getOne ($className, $condition, $included=true, $parameters=null, $useCache=NULL)
 Returns an instance of $className from the database, from $keyvalues values of the primary key or with a condition.
 
static getById ($className, $keyValues, $included=true, $useCache=NULL)
 Returns an instance of $className from the database, from $keyvalues values of the primary key.
 
static connect ($offset, $wrapper, $dbType, $dbName, $serverName='127.0.0.1', $port='3306', $user='root', $password='', $options=[], $cache=false)
 Establishes the connection to the database using the past parameters.
 
static startDatabase (&$config, $offset=null)
 Establishes the connection to the database using the $config array.
 
static getDbOffset (&$config, $offset=null)
 
static isConnected ($offset='default')
 Returns true if the connection to the database is established.
 
static setTransformerOp (string $op)
 Sets the transformer operation.
 
static closeDb ($offset='default')
 Closes the active pdo connection to the database.
 
static setModelDatabase ($model, $database='default')
 Defines the database connection to use for $model class.
 
static setModelsDatabases ($modelsDatabase)
 Defines the database connections to use for models classes.
 
static getDatabase ($offset='default')
 Returns the database instance defined at $offset key in config.
 
static getDatabases ()
 
static updateDatabaseParams (array &$config, array $parameters, $offset='default')
 
static start ()
 
static getDbCacheInstance ($model)
 
static warmupCache ($className, $condition='', $included=false, $parameters=[])
 
static setCache (AbstractDAOCache $cache)
 
static getCache ()
 
static getModelsDatabase ()
 
- Static Public Member Functions inherited from DAOCoreTrait
static _affectsRelationObjects ($className, $classPropKey, $manyToOneQueries, $oneToManyQueries, $manyToManyParsers, $objects, $included, $useCache)
 
static _initRelationFields ($included, $metaDatas, &$invertedJoinColumns, &$oneToManyFields, &$manyToManyFields)
 
static _getIncludedForStep ($included)
 
static _getFieldList ($tableName, $metaDatas)
 
static _loadObjectFromRow (Database $db, $row, $className, $invertedJoinColumns, &$manyToOneQueries, $oneToManyFields, $manyToManyFields, &$oneToManyQueries, &$manyToManyParsers, $memberNames, $accessors, $transformers, $primaryKeys)
 
static _loadSimpleObjectFromRow (Database $db, $row, $className, $memberNames, $transformers)
 
static storeDbCache (string $model)
 
static getModels ($dbOffset='default')
 
- Static Public Member Functions inherited from DAOUpdatesTrait
static remove ($instance)
 Deletes the object $instance from the database.
 
static deleteAll ($modelName, $where, $params=[])
 Deletes all instances from $modelName matching the condition $where.
 
static deleteAllChildren (object $instance)
 
static updateAll (string $modelName, array $values, string $condition, array $params)
 Mass update for $modelName matching the condition $where, with an associative array of $values.
 
static delete ($modelName, $ids)
 Deletes all instances from $modelName corresponding to $ids.
 
static deleteById ($modelName, $id)
 
static insert ($instance, $insertMany=false)
 Inserts a new instance $instance into the database.
 
static insertOrUpdateAllManyToMany ($instance)
 Updates manyToMany members.
 
static insertOrUpdateManyToMany ($instance, $member)
 Updates the $member member of $instance annotated by a ManyToMany.
 
static updateGroup ($instances, $updateMany=false)
 Updates an array of $instances in the database.
 
static save ($instance, $updateMany=false)
 
- Static Public Member Functions inherited from DAORelationsTrait
static _getIncludedForStep ($included)
 
static _initRelationFields ($included, $metaDatas, &$invertedJoinColumns, &$oneToManyFields, &$manyToManyFields)
 
static getManyToOne ($instance, $member, $included=false, $useCache=NULL)
 Loads member associated with $instance by a ManyToOne relationship.
 
static getOneToMany ($instance, $member, $included=true, $useCache=NULL, $annot=null)
 Assign / load the child records in the $member member of $instance.
 
static getManyToMany ($instance, $member, $included=false, $array=null, $useCache=NULL)
 Assigns / loads the child records in the $member member of $instance.
 
static affectsManyToManys ($instance, $array=NULL, $useCache=NULL)
 
- Static Public Member Functions inherited from DAORelationsAssignmentsTrait
static _affectsRelationObjects ($className, $classPropKey, $manyToOneQueries, $oneToManyQueries, $manyToManyParsers, $objects, $included, $useCache)
 
- Static Public Member Functions inherited from DAOUQueries
static uGetAll ($className, $ucondition='', $included=true, $parameters=null, $useCache=null)
 Returns an array of $className objects from the database.
 
static uCount ($className, $ucondition='', $parameters=null)
 Returns the number of objects of $className from the database respecting the condition possibly passed as parameter.
 
static uAggregate (string $className, string $ucondition='', ?array $parameters=null, ?array $groupBy=null, string $function='COUNT', string $field=' *', bool $distinct=false)
 
static uCountGroupBy (string $className, string $ucondition='', ?array $parameters=null, ?array $groupBy=null, string $countField=' *', bool $distinct=false)
 
static uAvgGroupBy (string $className, string $avgField, string $ucondition='', ?array $parameters=null, ?array $groupBy=null)
 
static uSumGroupBy (string $className, string $sumField, string $ucondition='', ?array $parameters=null, ?array $groupBy=null)
 
static uMinGroupBy (string $className, string $minField, string $ucondition='', ?array $parameters=null, ?array $groupBy=null)
 
static uMaxGroupBy (string $className, string $maxField, string $ucondition='', ?array $parameters=null, ?array $groupBy=null)
 
static uGetOne ($className, $ucondition, $included=true, $parameters=null, $useCache=null)
 Returns an instance of $className from the database, from $keyvalues values of the primary key.
 
- Static Public Member Functions inherited from DAOTransactionsTrait
static beginTransaction ($offset='default')
 Initiates a transaction.
 
static commit ($offset='default')
 Commits a transaction.
 
static commitToLevel ($transactionLevel, $offset='default')
 Commits nested transactions up to level $transactionLevel.
 
static commitAll ($offset='default')
 Commits all nested transactions (up to level 0)
 
static rollBack ($offset='default')
 Rolls back a transaction.
 
static rollBackToLevel ($transactionLevel, $offset='default')
 Rolls back nested transactions up to level $transactionLevel.
 
static rollBackAll ($offset='default')
 Rolls back all nested transactions (up to level 0)
 
static callInTransaction ($callback, $offset,... $parameters)
 Call a callback with an array of parameters in a transaction.
 
static setIsolationLevel (string $offset='default', $isolationLevel='READ COMMITTED')
 Sets the isolation level for transactions.
 
- Static Public Member Functions inherited from DAOPooling
static initPooling (&$config, $offset=null, int $size=16)
 Initialize pooling (To invoke during Swoole startup)
 
static pool ($offset='default')
 gets a new DbConnection from pool
 
static freePool ($db)
 
static go ($asyncCallable, $offset='default')
 
- Static Public Member Functions inherited from DAOBulkUpdatesTrait
static toInsert ($instance)
 Adds an instance in the bulk list of objects to insert.
 
static toInserts (array $instances)
 Adds an array of instances in the bulk list of objects to insert.
 
static flushInserts ()
 Executes all waiting insert operations.
 
static toUpdate ($instance)
 Adds an instance in the bulk list of objects to update.
 
static toUpdates (array $instances)
 Adds an array of instances in the bulk list of objects to update.
 
static updateGroups ($count=5)
 
static insertGroups ($count=5)
 
static deleteGroups ($count=5)
 
static flushUpdates ()
 Executes all waiting update operations.
 
static toDelete ($instance)
 Adds an instance in the bulk list of objects to delete.
 
static toDeletes (array $instances)
 Adds an array of instances in the bulk list of objects to delete.
 
static flushDeletes ()
 Executes all waiting delete operations.
 
static flush ()
 Executes all waiting operations (inserts, updates, deletes)
 
static clearBulks (?array $operations=null, ?array $classes=null)
 Clear bulk and clear instances waiting for operations.
 
static countInstancesBulk (string $class, string $operation='update')
 Return the count of instances waiting for flushing in a bulk.
 
- Static Public Member Functions inherited from DAOPreparedTrait
static prepareGetById ($name, $className, $included=false, $cache=null)
 
static prepareGetOne ($name, $className, $condition='', $included=false, $cache=null)
 
static prepareGetAll ($name, $className, $condition='', $included=false, $cache=null)
 
static executePrepared ($name, $params=[], $useCache=false)
 
static storeDbCachePrepared ($name)
 
static getPrepared (string $name)
 Returns the daoPreparedQuery corresponding to a name.
 

Static Protected Member Functions

static _getOne (Database $db, $className, ConditionParser $conditionParser, $included, $useCache)
 
static _getAll (Database $db, $className, ConditionParser $conditionParser, $included=true, $useCache=NULL)
 
- Static Protected Member Functions inherited from DAO
static getConditionParser ($className, $keyValues)
 
- Static Protected Member Functions inherited from DAOCoreTrait
static prepareManyToMany ($db, &$ret, $instance, $member, $annot=null)
 
static prepareManyToOne (&$ret, $instance, $value, $fkField, $annotationArray)
 
static prepareOneToMany (&$ret, $instance, $member, $annot=null)
 
static getClass_ ($instance)
 
static getInstance_ ($instance)
 
static getValue_ ($instance, $member)
 
static getFirstKeyValue_ ($instance)
 
static applyTransformers ($transformers, &$row, $memberNames)
 
static loadManys ($o, $db, $oneToManyFields, &$oneToManyQueries, $manyToManyFields, &$manyToManyParsers)
 
- Static Protected Member Functions inherited from DAOUpdatesTrait
static deleteManyToManyChildren (object $instance, string $memberName)
 
static deleteOneToManyChildren (object $instance, string $memberName)
 
- Static Protected Member Functions inherited from DAORelationsPrepareTrait
static prepareManyToMany ($db, &$ret, $instance, $member, $annot=null)
 Prepares members associated with $instance with a ManyToMany type relationship.
 
static prepareOneToMany (&$ret, $instance, $member, $annot=null)
 Prepares members associated with $instance with a oneToMany type relationship.
 
static prepareManyToOne (&$ret, $instance, $value, $fkField, $annotationArray)
 Prepares members associated with $instance with a manyToOne type relationship.
 
- Static Protected Member Functions inherited from DAORelationsAssignmentsTrait
static setToMember ($member, $instance, $value, $accessor)
 
static getAccessor ($member, $instance, $part)
 
- Static Protected Member Functions inherited from DAOUQueries
static uParse ($db, $className, &$ucondition, $quote, &$fields=null)
 
static uParseExpression ($db, $className, $expression, &$expressionArray, &$condition, &$ucondition, &$aliases, $quote, &$fields=null)
 
static getAnnotFieldsInRelations ($className)
 
static uGetExpressions ($condition)
 
- Static Protected Member Functions inherited from DAOBulkUpdatesTrait
static getBulk ($class, $operation='update')
 
static toOperation ($instance, string $operation)
 
static toOperations (array $instances, string $operation)
 

Static Private Member Functions

static sloadObjectFromRow ($row, $className)
 

Additional Inherited Members

- Static Public Attributes inherited from DAO
static $db
 
static $useTransformers = false
 
static $transformerOp = 'transform'
 
- Static Protected Attributes inherited from DAO
static $modelsDatabase = [ ]
 
static $cache
 
- Static Protected Attributes inherited from DAOCoreTrait
static $accessors = []
 
static $fields = []
 
- Static Protected Attributes inherited from DAOUQueries
static $annotFieldsInRelations = []
 
- Static Protected Attributes inherited from DAOPooling
static $pool
 
- Static Protected Attributes inherited from DAOBulkUpdatesTrait
static $bulks = [ 'insert' => [ ],'update' => [ ],'delete' => [ ] ]
 
- Static Protected Attributes inherited from DAOPreparedTrait
static $preparedDAOQueries = []
 

Detailed Description

DAO class for models without relationships Model classes must declare public members only Ubiquity\orm$SDAO This class is part of Ubiquity.

Author
jcheron myadd.nosp@m.ress.nosp@m.mail@.nosp@m.gmai.nosp@m.l.com
Version
1.0.0

Definition at line 22 of file SDAO.php.

Member Function Documentation

◆ _getAll()

static _getAll ( Database  $db,
  $className,
ConditionParser  $conditionParser,
  $included = true,
  $useCache = NULL 
)
staticprotected
Parameters
Database$db
string$className
ConditionParser$conditionParser
boolean | array$included
boolean | null$useCache
Returns
array

Reimplemented from DAOCoreTrait.

Definition at line 48 of file SDAO.php.

◆ _getOne()

static _getOne ( Database  $db,
  $className,
ConditionParser  $conditionParser,
  $included,
  $useCache 
)
staticprotected

Reimplemented from DAOCoreTrait.

Definition at line 24 of file SDAO.php.

◆ sloadObjectFromRow()

static sloadObjectFromRow (   $row,
  $className 
)
staticprivate

Definition at line 63 of file SDAO.php.

◆ update()

static update (   $instance,
  $updateMany = false 
)
static

Updates an existing $instance in the database.

Be careful not to modify the primary key

Parameters
object$instanceinstance to modify
boolean$updateManyAdds or updates ManyToMany members

Reimplemented from DAOUpdatesTrait.

Definition at line 81 of file SDAO.php.


The documentation for this class was generated from the following file: