Ubiquity  2.0.0
php rapid development framework
DAO Class Reference
+ Inheritance diagram for DAO:

Static Public Member Functions

static getManyToOne ($instance, $member, $useCache=NULL)
 Loads member associated with $instance by a ManyToOne type relationship. More...
 
static getOneToMany ($instance, $member, $useCache=NULL, $annot=null)
 Assign / load the child records in the $member member of $instance. More...
 
static affectsOneToManyFromArray ($instance, $member, $array=null, $mappedBy=null)
 
static getManyToMany ($instance, $member, $array=null, $useCache=NULL)
 Assigns / loads the child records in the $member member of $instance. More...
 
static affectsManyToManys ($instance, $array=NULL, $useCache=NULL)
 
static getAll ($className, $condition='', $loadManyToOne=true, $loadOneToMany=false, $useCache=NULL)
 Returns an array of $className objects from the database. More...
 
static count ($className, $condition='')
 Returns the number of objects of $className from the database respecting the condition possibly passed as parameter. More...
 
static getOne ($className, $keyValues, $loadManyToOne=true, $loadOneToMany=false, $useCache=NULL)
 Returns an instance of $className from the database, from $keyvalues values of the primary key. More...
 
static connect ($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. More...
 
static isConnected ()
 Returns true if the connection to the database is estabished. More...
 
- Static Public Member Functions inherited from DAOUpdatesTrait
static remove ($instance)
 Deletes the object $instance from the database. More...
 
static delete ($modelName, $ids)
 
static insert ($instance, $insertMany=false)
 Inserts a new instance $ instance into the database. More...
 
static insertOrUpdateAllManyToMany ($instance)
 Met à jour les membres de $instance annotés par un ManyToMany. More...
 
static insertOrUpdateManyToMany ($instance, $member)
 Updates the $member member of $instance annotated by a ManyToMany. More...
 
static update ($instance, $updateMany=false)
 Updates an existing $instance in the database. More...
 
static save ($instance, $updateMany=false)
 

Static Public Attributes

static $db
 

Static Private Member Functions

static _getOneToManyFromArray (&$ret, $array, $fkv, $mappedBy)
 
static setToMember ($member, $instance, $value, $class, $part)
 
static getManyToManyFromArray (&$ret, $instance, $array, $class, $parser)
 
static _affectsObjectsFromArray ($queries, $objects, $affectsCallback, $useCache=NULL)
 
static affectsManyToOneFromArray ($object, $member, $manyToOneObjects, $fkField)
 
static loadObjectFromRow ($row, $className, $invertedJoinColumns, $oneToManyFields, $members, &$oneToManyQueries, &$manyToOneQueries)
 
static prepareOneToMany (&$ret, $instance, $member, $annot=null)
 Prepares members associated with $instance with a oneToMany type relationship. More...
 
static prepareManyToOne (&$ret, $value, $fkField, $annotationArray)
 Prepares members associated with $instance with a manyToOne type relationship. More...
 

Detailed Description

Definition at line 18 of file DAO.php.

Member Function Documentation

◆ _affectsObjectsFromArray()

static _affectsObjectsFromArray (   $queries,
  $objects,
  $affectsCallback,
  $useCache = NULL 
)
staticprivate

Definition at line 231 of file DAO.php.

◆ _getOneToManyFromArray()

static _getOneToManyFromArray ( $ret,
  $array,
  $fkv,
  $mappedBy 
)
staticprivate

Definition at line 52 of file DAO.php.

◆ affectsManyToManys()

static affectsManyToManys (   $instance,
  $array = NULL,
  $useCache = NULL 
)
static
Parameters
object$instance
array$array
boolean$useCache

Definition at line 149 of file DAO.php.

◆ affectsManyToOneFromArray()

static affectsManyToOneFromArray (   $object,
  $member,
  $manyToOneObjects,
  $fkField 
)
staticprivate

Definition at line 242 of file DAO.php.

◆ affectsOneToManyFromArray()

static affectsOneToManyFromArray (   $instance,
  $member,
  $array = null,
  $mappedBy = null 
)
static
Parameters
object$instance
string$member
array$array
string$mappedBy

Definition at line 93 of file DAO.php.

◆ connect()

static connect (   $dbType,
  $dbName,
  $serverName = "127.0.0.1",
  $port = "3306",
  $user = "root",
  $password = "",
  $options = [],
  $cache = false 
)
static

Establishes the connection to the database using the past parameters.

Parameters
string$dbType
string$dbName
string$serverName
string$port
string$user
string$password
array$options
boolean$cache

Definition at line 376 of file DAO.php.

◆ count()

static count (   $className,
  $condition = '' 
)
static

Returns the number of objects of $className from the database respecting the condition possibly passed as parameter.

Parameters
string$classNamecomplete classname of the model to load
string$conditionPart following the WHERE of an SQL statement
Returns
int count of objects

Definition at line 332 of file DAO.php.

◆ getAll()

static getAll (   $className,
  $condition = '',
  $loadManyToOne = true,
  $loadOneToMany = false,
  $useCache = NULL 
)
static

Returns an array of $className objects from the database.

Parameters
string$classNameclass name of the model to load
string$conditionPart following the WHERE of an SQL statement
boolean$loadManyToOneif true, charges associate members with manyToOne association
boolean$loadOneToManyif true, charges associate members with oneToMany association
boolean$useCacheuse the active cache if true
Returns
array

Definition at line 193 of file DAO.php.

◆ getManyToMany()

static getManyToMany (   $instance,
  $member,
  $array = null,
  $useCache = NULL 
)
static

Assigns / loads the child records in the $member member of $instance.

If $ array is null, the records are loaded from the database

Parameters
object$instance
string$memberMember on which a ManyToMany annotation must be present
array$arrayoptional parameter containing the list of possible child records
boolean$useCache

Definition at line 127 of file DAO.php.

◆ getManyToManyFromArray()

static getManyToManyFromArray ( $ret,
  $instance,
  $array,
  $class,
  $parser 
)
staticprivate

Definition at line 159 of file DAO.php.

◆ getManyToOne()

static getManyToOne (   $instance,
  $member,
  $useCache = NULL 
)
static

Loads member associated with $instance by a ManyToOne type relationship.

Parameters
object$instance
string$member
boolean$useCache

Definition at line 30 of file DAO.php.

◆ getOne()

static getOne (   $className,
  $keyValues,
  $loadManyToOne = true,
  $loadOneToMany = false,
  $useCache = NULL 
)
static

Returns an instance of $className from the database, from $keyvalues values of the primary key.

Parameters
String$classNamecomplete classname of the model to load
Array | string$keyValuesprimary key values or condition
$loadManyToOneif true, charges associate members with manyToOne association
$loadOneToManyif true, charges associate members with oneToMany association
boolean$useCacheuse cache if true
Returns
object the instance loaded or null if not found

Definition at line 348 of file DAO.php.

◆ getOneToMany()

static getOneToMany (   $instance,
  $member,
  $useCache = NULL,
  $annot = null 
)
static

Assign / load the child records in the $member member of $instance.

Parameters
object$instance
string$memberMember on which a oneToMany annotation must be present
boolean$useCache
array$annotused internally

Definition at line 71 of file DAO.php.

◆ isConnected()

static isConnected ( )
static

Returns true if the connection to the database is estabished.

Returns
boolean

Definition at line 390 of file DAO.php.

◆ loadObjectFromRow()

static loadObjectFromRow (   $row,
  $className,
  $invertedJoinColumns,
  $oneToManyFields,
  $members,
$oneToManyQueries,
$manyToOneQueries 
)
staticprivate
Parameters
array$row
string$className
array$invertedJoinColumns
array$oneToManyFields
array$members
array$oneToManyQueries
array$manyToOneQueries
Returns
object

Definition at line 260 of file DAO.php.

◆ prepareManyToOne()

static prepareManyToOne ( $ret,
  $value,
  $fkField,
  $annotationArray 
)
staticprivate

Prepares members associated with $instance with a manyToOne type relationship.

Parameters
$retarray of sql conditions
mixed$value
string$fkField
array$annotationArray

Definition at line 316 of file DAO.php.

◆ prepareOneToMany()

static prepareOneToMany ( $ret,
  $instance,
  $member,
  $annot = null 
)
staticprivate

Prepares members associated with $instance with a oneToMany type relationship.

Parameters
$retarray of sql conditions
object$instance
string$memberMember on which a OneToMany annotation must be present
array$annotused internally

Definition at line 292 of file DAO.php.

◆ setToMember()

static setToMember (   $member,
  $instance,
  $value,
  $class,
  $part 
)
staticprivate

Definition at line 108 of file DAO.php.

Field Documentation

◆ $db

$db
static

Definition at line 22 of file DAO.php.


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