Data views: Rename getTableName() to getQueryName()

getQueryName is more obvious because the function returns
the name of the query the view should use for querying.
This commit is contained in:
Eric Lippmann 2014-04-17 13:59:11 +02:00
parent 62e044d888
commit e804f56d5f
5 changed files with 7 additions and 27 deletions

View File

@ -65,15 +65,17 @@ abstract class DataView implements Filterable
*/ */
public function __construct(Backend $ds, array $columns = null) public function __construct(Backend $ds, array $columns = null)
{ {
$this->query = $ds->select()->from(static::getTableName(), $columns === null ? $this->getColumns() : $columns); $this->query = $ds->select()->from(static::getQueryName(), $columns === null ? $this->getColumns() : $columns);
} }
/** /**
* Get the queried table name * Get the query name this data view relies on
*
* By default this is this class' name without its namespace
* *
* @return string * @return string
*/ */
public static function getTableName() public static function getQueryName()
{ {
$tableName = explode('\\', get_called_class()); $tableName = explode('\\', get_called_class());
$tableName = end($tableName); $tableName = end($tableName);

View File

@ -90,12 +90,7 @@ class HostStatus extends DataView
); );
} }
/** public static function getQueryName()
* Return the table name
*
* @return string
*/
public static function getTableName()
{ {
return 'status'; return 'status';
} }

View File

@ -49,16 +49,6 @@ class Hostgroup extends DataView
); );
} }
/**
* Return the table name for this view
*
* @return string
*/
public static function getTableName()
{
return 'hostgroup';
}
/** /**
* Retrieve default sorting rules for particular columns. These involve sort order and potential additional to sort * Retrieve default sorting rules for particular columns. These involve sort order and potential additional to sort
* *

View File

@ -124,9 +124,7 @@ class ServiceStatus extends DataView
); );
} }
public static function getQueryName()
public static function getTableName()
{ {
return 'status'; return 'status';
} }

View File

@ -48,11 +48,6 @@ class Servicegroup extends DataView
); );
} }
public static function getTableName()
{
return 'servicegroup';
}
/** /**
* Retrieve default sorting rules for particular columns. These involve sort order and potential additional to sort * Retrieve default sorting rules for particular columns. These involve sort order and potential additional to sort
* *