<?php

/**
 * Class that operate on table 'productionexecutionproduct'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2018-11-28 13:58
 */
class ProductionexecutionproductMySqlExtDAO extends ProductionexecutionproductMySqlDAO {

    public function queryAllProductsByExecutionId($id) {
        $sql = 'SELECT productionexecutionproduct. * , product.productName ,product.productBuyPrice , unit.unitName,size.name as sizeName,color.name as colorName
		FROM productionexecutionproduct
		JOIN product
			 ON product.productId = productionexecutionproduct.productid
		JOIN productunit
			 ON  productunit.productunitid=productionexecutionproduct.unitid
		JOIN unit
         	 ON unit.unitId= productunit.unitid

                left join sizecolor as size on size.id=productionexecutionproduct.sizeid
                left join sizecolor as color on color.id=productionexecutionproduct.colorid

		where productionexecutionproduct.executionid=' . $id . '
		';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

}

?>