<?php

/**
 * Class that operate on table 'settingoperation'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2014-04-01 11:09
 */
class SettingoperationMySqlExtDAO extends SettingoperationMySqlDAO {

    //get workstation names where id = operation id

    public function queryAllWithWorkstation() {

        $sql = 'SELECT settingoperation.*,workstation.workname,assets.assetsName,workstation.workerhours
		        FROM settingoperation
			left JOIN workstation on settingoperation.workStationID = workstation.workstationid
			left JOIN assets on settingoperation.assetesID = assets.assetId';

        $sqlQuery = new SqlQuery($sql);

        //print_r($sqlQuery );

        return $this->getList($sqlQuery);
    }

    public function queryByoperationid($value) {
        $sql = 'SELECT * FROM settingoperation WHERE settingOperationID = ?';
        $sqlQuery = new SqlQuery($sql);
        $sqlQuery->setNumber($value);
        return $this->getList($sqlQuery);
    }

    public function loadByopertaionid($value) {
        $sql = 'SELECT settingoperation.* FROM settingoperation join stagestep where settingoperation.settingOperationID=stagestep.operationId and stagestep.operationId= ?';
        $sqlQuery = new SqlQuery($sql);
        $sqlQuery->setNumber($value);
        return $this->getRow($sqlQuery);
    }

}

?>