当前位置: 首页>>代码示例>>PHP>>正文


PHP fORM::isClassMappedToTable方法代码示例

本文整理汇总了PHP中fORM::isClassMappedToTable方法的典型用法代码示例。如果您正苦于以下问题:PHP fORM::isClassMappedToTable方法的具体用法?PHP fORM::isClassMappedToTable怎么用?PHP fORM::isClassMappedToTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fORM的用法示例。


在下文中一共展示了fORM::isClassMappedToTable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: determineSubject

 /**
  * Takes information from a method call and determines the subject, route and if subject was plural
  * 
  * @param string $class    The class the method was called on
  * @param string $subject  An underscore_notation subject - either a singular or plural class name
  * @param string $route    The route to the subject
  * @return array  An array with the structure: array(0 => $subject, 1 => $route, 2 => $plural)
  */
 private static function determineSubject($class, $subject, $route)
 {
     $schema = fORMSchema::retrieve($class);
     $table = fORM::tablize($class);
     $type = '*-to-many';
     $plural = FALSE;
     // one-to-many relationships need to use plural forms
     $singular_form = fGrammar::singularize($subject, TRUE);
     if ($singular_form && fORM::isClassMappedToTable($singular_form)) {
         $subject = $singular_form;
         $plural = TRUE;
     } elseif (!fORM::isClassMappedToTable($subject) && in_array(fGrammar::underscorize($subject), $schema->getTables())) {
         $subject = fGrammar::singularize($subject);
         $plural = TRUE;
     }
     $related_table = fORM::tablize($subject);
     $one_to_one = fORMSchema::isOneToOne($schema, $table, $related_table, $route);
     if ($one_to_one) {
         $type = 'one-to-one';
     }
     if ($one_to_one && $plural || !$plural && !$one_to_one) {
         throw new fProgrammerException('The table %1$s is not in a %2$srelationship with the table %3$s', $table, $type, $related_table);
     }
     $route = fORMSchema::getRouteName($schema, $table, $related_table, $route, $type);
     return array($subject, $route, $plural);
 }
开发者ID:mrjwc,项目名称:printmaster,代码行数:34,代码来源:fActiveRecord.php


注:本文中的fORM::isClassMappedToTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。