gyro/core/model/base/dbtablesubquery.csl.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Masks a sub query as a table, that can be used in Joins 00004 * 00005 * @author Gerd Riesselmann 00006 * @ingroup Model 00007 */ 00008 class DBTableSubquery extends DBTable { 00009 /** 00010 * The query to mask as table 00011 */ 00012 protected $query; 00013 00014 /** 00015 * Constructor 00016 * 00017 * @param IDBTable $table The table to overload alias for 00018 * @param string $alias 00019 */ 00020 public function __construct($query, $alias, $table = null) { 00021 $this->query = $query; 00022 00023 $fields = array(); 00024 if ($table instanceof IDBTable) { 00025 $fields = $table->get_table_fields(); 00026 } 00027 parent::__construct($alias, $fields); 00028 } 00029 00030 /** 00031 * Returns name of table, but escaped 00032 * 00033 * @return string 00034 */ 00035 public function get_table_name_escaped() { 00036 return '(' . $this->query . ')'; 00037 } 00038 }