Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
DAOUpdatesTrait Class Reference
+ Inheritance diagram for DAOUpdatesTrait:

Static Public Member Functions

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 update ($instance, $updateMany=false)
 Updates an existing $instance in the database.
 
static updateGroup ($instances, $updateMany=false)
 Updates an array of $instances in the database.
 
static save ($instance, $updateMany=false)
 

Static Protected Member Functions

static deleteManyToManyChildren (object $instance, string $memberName)
 
static deleteOneToManyChildren (object $instance, string $memberName)
 

Static Private Member Functions

static removeByKey_ ($className, $tableName, $keyAndValues)
 
static remove_ ($db, $tableName, $where, $params)
 

Detailed Description

Definition at line 24 of file DAOUpdatesTrait.php.

Member Function Documentation

◆ delete()

static delete (   $modelName,
  $ids 
)
static

Deletes all instances from $modelName corresponding to $ids.

Parameters
string$modelName
array | int$ids
Returns
int|boolean

Definition at line 177 of file DAOUpdatesTrait.php.

◆ deleteAll()

static deleteAll (   $modelName,
  $where,
  $params = [] 
)
static

Deletes all instances from $modelName matching the condition $where.

Parameters
string$modelName
string$where
array$params
Returns
int|boolean

Definition at line 93 of file DAOUpdatesTrait.php.

◆ deleteAllChildren()

static deleteAllChildren ( object  $instance)
static

Definition at line 121 of file DAOUpdatesTrait.php.

◆ deleteById()

static deleteById (   $modelName,
  $id 
)
static

Definition at line 190 of file DAOUpdatesTrait.php.

◆ deleteManyToManyChildren()

static deleteManyToManyChildren ( object  $instance,
string  $memberName 
)
staticprotected

Definition at line 100 of file DAOUpdatesTrait.php.

◆ deleteOneToManyChildren()

static deleteOneToManyChildren ( object  $instance,
string  $memberName 
)
staticprotected

Definition at line 112 of file DAOUpdatesTrait.php.

◆ insert()

static insert (   $instance,
  $insertMany = false 
)
static

Inserts a new instance $instance into the database.

Parameters
object$instancethe instance to insert
boolean$insertManyif true, save instances related to $instance by a ManyToMany association

Definition at line 204 of file DAOUpdatesTrait.php.

◆ insertOrUpdateAllManyToMany()

static insertOrUpdateAllManyToMany (   $instance)
static

Updates manyToMany members.

Parameters
object$instance

Definition at line 258 of file DAOUpdatesTrait.php.

◆ insertOrUpdateManyToMany()

static insertOrUpdateManyToMany (   $instance,
  $member 
)
static

Updates the $member member of $instance annotated by a ManyToMany.

Parameters
Object$instance
String$member

Definition at line 274 of file DAOUpdatesTrait.php.

◆ remove()

static remove (   $instance)
static

Deletes the object $instance from the database.

Parameters
object$instanceinstance à supprimer

Definition at line 31 of file DAOUpdatesTrait.php.

◆ remove_()

static remove_ (   $db,
  $tableName,
  $where,
  $params 
)
staticprivate
Parameters
\Ubiquity\db\Database$db
string$className
string$tableName
string$where
array$params
Returns
boolean|int the number of rows that were modified or deleted by the SQL statement you issued

Definition at line 71 of file DAOUpdatesTrait.php.

◆ removeByKey_()

static removeByKey_ (   $className,
  $tableName,
  $keyAndValues 
)
staticprivate
Parameters
string$className
string$tableName
array$keyAndValues
Returns
int the number of rows that were modified or deleted by the SQL statement you issued

Definition at line 46 of file DAOUpdatesTrait.php.

◆ save()

static save (   $instance,
  $updateMany = false 
)
static
Parameters
object$instance
boolean$updateMany
Returns
boolean|int

Definition at line 396 of file DAOUpdatesTrait.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 in SDAO.

Definition at line 315 of file DAOUpdatesTrait.php.

◆ updateAll()

static updateAll ( string  $modelName,
array  $values,
string  $condition,
array  $params 
)
static

Mass update for $modelName matching the condition $where, with an associative array of $values.

Parameters
string$modelName
array$values
string$condition
array$params

Definition at line 149 of file DAOUpdatesTrait.php.

◆ updateGroup()

static updateGroup (   $instances,
  $updateMany = false 
)
static

Updates an array of $instances in the database.

Be careful not to modify the primary key

Parameters
array$instancesinstances to modify
boolean$updateManyAdds or updates ManyToMany members
Returns
boolean

Definition at line 352 of file DAOUpdatesTrait.php.


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