本文整理汇总了PHP中Reflector::getTables方法的典型用法代码示例。如果您正苦于以下问题:PHP Reflector::getTables方法的具体用法?PHP Reflector::getTables怎么用?PHP Reflector::getTables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reflector
的用法示例。
在下文中一共展示了Reflector::getTables方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTags
/**
* Compiles and returns the tags.
*
* @return array
*/
public function getTags()
{
// Get affected database and tables, add prefixes
$database = $this->prefix($this->reflector->getDatabase(), self::PREFIX_DATABASE);
// Get affected tables, don't add prefixes yes
$tables = $this->reflector->getTables();
// If rows should not be considered, we don't have to differ between specific and unspecific queries
// We can simply prefix all tables with the database and return them
if ($this->considerRows === false) {
return $this->prefix($tables, $database);
}
// Get affected rows as multidimensional array per table
$rows = $this->reflector->getRows();
// Create the table tags with corresponding prefix
// Depending on whether the queries are specific or not
$tags = $this->getTableTags($tables, $rows);
// Then we loop trough all these tags and add a tag for each row
// Consisting of the prefixed table and the row with prefix
foreach ($tables as $table) {
if (!isset($rows[$table])) {
continue;
}
$tablePrefix = $this->prefix($table, self::PREFIX_TABLE_SPECIFIC);
$rowPrefix = $this->prefix(self::PREFIX_ROW, $tablePrefix);
$tags = array_merge($tags, $this->prefix($rows[$table], $rowPrefix));
}
return $this->prefix($tags, $database);
}
示例2: tablesCachable
/**
* Checks if the tables returned by the reflector are cachable.
*
* If "include-tables" are available, it will only return true if ALL affected tables exists in "include-tables".
* If "exclude-tables" are enabled, it will only return false if ANY affected table exists in "exclude-tables".
*
* @return bool
*/
private function tablesCachable()
{
$tables = $this->reflector->getTables();
if ($this->isInclusive()) {
foreach ($tables as $table) {
if (!$this->tableIncluded($table)) {
return false;
}
}
return true;
}
foreach ($tables as $table) {
if ($this->tableExcluded($table)) {
return false;
}
}
return true;
}