dibi::delete PHP Method

delete() public static method

public static delete ( $table ) : Dibi\Fluent
return Dibi\Fluent
    public static function delete($table)
    {
        return self::getConnection()->delete($table);
    }

Usage Example

示例#1
0
 /**
  * update user roles [delete & insert]
  *
  * @param int User id
  * @param int Role id
  */
 public function updateUserRoles($userId, $roles)
 {
     try {
         dibi::begin();
         dibi::delete(self::ACL_USERS_2_ROLES_TABLE)->where('user_id = %i', $userId)->execute();
         foreach ($roles as $role) {
             dibi::insert(self::ACL_USERS_2_ROLES_TABLE, array('user_id' => $userId, 'role_id' => $role))->execute();
         }
         dibi::commit();
     } catch (DibiDriverException $e) {
         dibi::rollback();
         throw $e;
     }
 }
All Usage Examples Of dibi::delete