<?php

/**
 * Class that operate on table 'properties'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2013-04-06 10:57
 */
class PropertiesMySqlExtDAO extends PropertiesMySqlDAO {

    public function propertiesWithoutRuleGroup() {
        $sql = 'SELECT distinct properties.propertyid
                FROM properties
                left join relusergroupproperties on relusergroupproperties.propertyid = properties.propertyid
                where relusergroupproperties.relusergrouppropertiesid is null';
        //echo $sql;
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function propertiesWithoutRuleGroup2($queryString = '') {//this one is with prop default
        $sql = 'select properties.propertyid,properties.propertydefault
                from
                (   SELECT distinct properties.propertyid
                    FROM properties
                    left join relusergroupproperties on (relusergroupproperties.propertyid = properties.propertyid ' . $queryString . ')
                    where relusergroupproperties.relusergrouppropertiesid is null
                ) as  temp
                join properties on properties.propertyid = temp.propertyid';
        //echo $sql;
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    /**
     * Get all records from table
     */
    public function queryAllEX() {
        $sql = 'SELECT properties.*,usergroupadmin.isallowed
                FROM properties
                left join usergroupadmin on usergroupadmin.propertyid = properties.propertyid';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

}

?>