Example #1
0
    /**
     * Deletes all associated DatagridColumnPreferences
     * @return void
     */
    public function DeleteAllDatagridColumnPreferences()
    {
        if (is_null($this->intDatagridId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateDatagridColumnPreference on this unsaved Datagrid.');
        }
        // Get the Database Object for this Class
        $objDatabase = Datagrid::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (DatagridColumnPreference::LoadArrayByDatagridId($this->intDatagridId) as $objDatagridColumnPreference) {
                $objDatagridColumnPreference->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`datagrid_column_preference`
				WHERE
					`datagrid_id` = ' . $objDatabase->SqlVariable($this->intDatagridId) . '
			');
    }