<?php

CLASS Lap extends RasioProject
{
	protected $set;
	protected $em;
	protected $login;

	public function set($set)
	{
		$this->em = $set->em;
	}
	
	public function getMinMax($set, $table, $grup, $where = array())
	{
		$grup = "CONCAT($grup)";
		$table = strtolower($table);
		$this->set($set);
		$sql = $this->em->addSelect("max($grup) as max, min($grup) as min");
		$sql = $this->em->getFrom($table, 'a');
		if(!empty($where)){
		    $sql = $this->em->getWhere('1=1');
		    foreach($where as $w){
		        $sql = $this->em->andWhere($w);    
		    }
		}
		
		$eks = $this->em->queryEks($sql);
		return $this->em->fetchObject($eks);
	}
	
}