public function _getDAL() {
		$dal = new \Asgard\Db\DAL($this->dataMapper->getDB());
		$table = $this->getTable();
		$dal->orderBy($this->orderBy);
		if($this->reversed)
			$dal->reverse();
		$dal->limit($this->limit);
		$dal->offset($this->offset);
		if($this->groupBy === null)
			$dal->groupBy($table.'.id');
		elseif($this->groupBy !== false)
			$dal->groupBy($this->groupBy);
		$dal->select($this->selects);

		$dal->having($this->processConditions($this->having));
		$dal->where($this->processConditions($this->where));

		if($this->definition->isI18N()) {
			$translation_table = $this->getTranslationTable();
			$selects = [$table.'.*'];
			foreach($this->definition->properties() as $name=>$property) {
				if($property->get('i18n'))
					$selects[] = $translation_table.'.'.$name;
			}
			$dal->addSelect($selects);
			$dal->from($table);
			$dal->leftjoin([
				$translation_table => $this->processConditions([
					$table.'.id = '.$translation_table.'.id',
					$translation_table.'.locale' => $this->locale
				])
			]);
		}
		else {
			$dal->addSelect([$table.'.*']);
			$dal->from($table);
		}

		$this->recursiveJointures($dal, $this->join, $this->definition, $this->getTable());

		foreach($this->dalCallbacks as $cb)
			$cb($dal);

		foreach($this->unions as $union)
			$dal->union($union->getDAL());

		return $dal;
	}
public function _getDAL() {
		$dal = new \Asgard\Db\DAL($this->dataMapper->getDB());
		$table = $this->getTable();
		$dal->orderBy($this->orderBy);
		if($this->reversed)
			$dal->reverse();
		$dal->limit($this->limit);
		$dal->offset($this->offset);
		if($this->groupBy === null)
			$dal->groupBy($table.'.id');
		elseif($this->groupBy !== false)
			$dal->groupBy($this->groupBy);
		$dal->select($this->selects);

		$dal->having($this->processConditions($this->having));
		$dal->where($this->processConditions($this->where));

		if($this->definition->isI18N()) {
			$translation_table = $this->getTranslationTable();
			$selects = [$table.'.*'];
			foreach($this->definition->properties() as $name=>$property) {
				if($property->get('i18n'))
					$selects[] = $translation_table.'.'.$name;
			}
			$dal->addSelect($selects);
			$dal->from($table);
			$dal->leftjoin([
				$translation_table => $this->processConditions([
					$table.'.id = '.$translation_table.'.id',
					$translation_table.'.locale' => $this->locale
				])
			]);
		}
		else {
			$dal->addSelect([$table.'.*']);
			$dal->from($table);
		}

		$this->recursiveJointures($dal, $this->join, $this->definition, $this->getTable());

		foreach($this->dalCallbacks as $cb)
			$cb($dal);

		foreach($this->unions as $union)
			$dal->union($union->getDAL());

		return $dal;
	}
public function _getDAL ( ) { $ dal = new \ Asgard \ Db \ DAL ( $ this -> dataMapper -> getDB ( ) ) ; $ table = $ this -> getTable ( ) ; $ dal -> orderBy ( $ this -> orderBy ) ; if ( $ this -> reversed ) $ dal -> reverse ( ) ; $ dal -> limit ( $ this -> limit ) ; $ dal -> offset ( $ this -> offset ) ; if ( $ this -> groupBy === null ) $ dal -> groupBy ( $ table . '.id' ) ; elseif ( $ this -> groupBy !== false ) $ dal -> groupBy ( $ this -> groupBy ) ; $ dal -> select ( $ this -> selects ) ; $ dal -> having ( $ this -> processConditions ( $ this -> having ) ) ; $ dal -> where ( $ this -> processConditions ( $ this -> where ) ) ; if ( $ this -> definition -> isI18N ( ) ) { $ translation_table = $ this -> getTranslationTable ( ) ; $ selects = [ $ table . '.*' ] ; foreach ( $ this -> definition -> properties ( ) as $ name => $ property ) { if ( $ property -> get ( 'i18n' ) ) $ selects [ ] = $ translation_table . '.' . $ name ; } $ dal -> addSelect ( $ selects ) ; $ dal -> from ( $ table ) ; $ dal -> leftjoin ( [ $ translation_table => $ this -> processConditions ( [ $ table . '.id = ' . $ translation_table . '.id' , $ translation_table . '.locale' => $ this -> locale ] ) ] ) ; } else { $ dal -> addSelect ( [ $ table . '.*' ] ) ; $ dal -> from ( $ table ) ; } $ this -> recursiveJointures ( $ dal , $ this -> join , $ this -> definition , $ this -> getTable ( ) ) ; foreach ( $ this -> dalCallbacks as $ cb ) $ cb ( $ dal ) ; foreach ( $ this -> unions as $ union ) $ dal -> union ( $ union -> getDAL ( ) ) ; return $ dal ; }
Build the DAL.
@return \Asgard\Db\DAL
Build the DAL .