本文整理汇总了PHP中Reflector::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Reflector::getType方法的具体用法?PHP Reflector::getType怎么用?PHP Reflector::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reflector
的用法示例。
在下文中一共展示了Reflector::getType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTableTags
/**
* Returns the prefixed table tags for a set of tables and rows.
*
* @param array $tables The tables to be tagged
* @param array $rows A multidimensional array containing the rows per table
*
* @return array
*/
private function getTableTags($tables, $rows)
{
$tags = [];
$type = $this->reflector->getType();
foreach ($tables as $table) {
$isSpecific = isset($rows[$table]) && !empty($rows[$table]);
// These types of queries require a specific tag
if ($type === Reflector::QUERY_TYPE_SELECT && $isSpecific || $type === Reflector::QUERY_TYPE_UPDATE && !$isSpecific || $type === Reflector::QUERY_TYPE_DELETE && !$isSpecific || $type === Reflector::QUERY_TYPE_TRUNCATE) {
$tags[] = $this->prefix($table, self::PREFIX_TABLE_SPECIFIC);
}
// While these ones require an unspecific one
if ($type === Reflector::QUERY_TYPE_SELECT && !$isSpecific || $type === Reflector::QUERY_TYPE_UPDATE || $type === Reflector::QUERY_TYPE_DELETE || $type === Reflector::QUERY_TYPE_INSERT) {
$tags[] = $this->prefix($table, self::PREFIX_TABLE_UNSPECIFIC);
}
}
return $tags;
}