本文整理汇总了PHP中ClassTools::getPhpReservedWords方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassTools::getPhpReservedWords方法的具体用法?PHP ClassTools::getPhpReservedWords怎么用?PHP ClassTools::getPhpReservedWords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassTools
的用法示例。
在下文中一共展示了ClassTools::getPhpReservedWords方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateModel
/**
* Validates the current table to make sure that it won't
* result in generated code that will not parse.
*
* This method may emit warnings for code which may cause problems
* and will throw exceptions for errors that will definitely cause
* problems.
*/
protected function validateModel()
{
parent::validateModel();
$table = $this->getTable();
// Check to see if any of the column constants are PHP reserved words.
$colConstants = array();
foreach ($table->getColumns() as $col) {
$colConstants[] = $this->getColumnName($col);
}
$reservedConstants = array_map('strtoupper', ClassTools::getPhpReservedWords());
$intersect = array_intersect($reservedConstants, $colConstants);
if (!empty($intersect)) {
throw new EngineException("One or more of your column names for [" . $table->getName() . "] table conflict with a PHP reserved word (" . implode(", ", $intersect) . ")");
}
}