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


PHP ActiveRecord::getSchemaInstance方法代码示例

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


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

示例1: __construct

 public function __construct($className, $fieldName, $tableAlias = false)
 {
     $schema = ActiveRecord::getSchemaInstance($className);
     if ($schema->fieldExists($fieldName)) {
         $this->tableName = $tableAlias ? $tableAlias : $schema->getName();
         $this->field = $schema->getField($fieldName);
     } else {
         throw new ARException("Unable to find defined schema or field: " . $className . "." . $fieldName);
     }
 }
开发者ID:saiber,项目名称:www,代码行数:10,代码来源:ARFieldHandle.php

示例2: getNewsPostEntry

 private function getNewsPostEntry($row, $params)
 {
     $row['title'] = unserialize($row['title']);
     $row = MultilingualObject::transformArray($row, ActiveRecord::getSchemaInstance('NewsPost'));
     return array('loc' => $this->router->createFullUrl(createNewsPostUrl(array('news' => $row), $this->application)));
 }
开发者ID:saiber,项目名称:www,代码行数:6,代码来源:SitemapController.php

示例3: registerAutoReference

 public function registerAutoReference($fieldName)
 {
     $foreignClassName = $this->getField($fieldName)->getForeignClassName();
     $this->autoReferences[] = $foreignClassName;
     $this->autoReferencedSchemas[] = ActiveRecord::getSchemaInstance($foreignClassName);
 }
开发者ID:saiber,项目名称:www,代码行数:6,代码来源:ARSchema.php

示例4: _generateTableDDL

 protected function _generateTableDDL($name, $intent = "")
 {
     $comma = ", " . $intent;
     $schema = ActiveRecord::getSchemaInstance($name);
     $table_name = $schema->getName();
     $field_list = $schema->GetFieldList();
     $primary_list = $schema->getPrimaryKeyList();
     $foreign_list = $schema->getForeignKeyList();
     if (count($field_list) < 1) {
         return null;
     }
     if (count($primary_list) > 1) {
         $auto_increment = false;
     } else {
         $auto_increment = true;
     }
     $sql = "CREATE TABLE " . $table_name . " ( " . $intent;
     // fields
     foreach ($field_list as $field) {
         $sql .= $field->getName() . " " . $this->_defineField($field, $auto_increment) . $comma;
         //foreign key
         if ($field instanceof ARForeignKeyField) {
             $sql .= " FOREIGN KEY ( " . $field->getName() . " ) REFERENCES " . $field->getForeignTableName() . "( " . $field->getForeignFieldName() . " ) " . $comma;
         }
     }
     //primary keys
     if (count($primary_list) > 0) {
         $sql .= " PRIMARY KEY ( ";
         foreach ($primary_list as $primary) {
             $sql .= $primary->getName() . $comma;
         }
         $sql = substr($sql, 0, -strlen($comma));
         $sql .= " )" . $comma;
     }
     $sql = substr($sql, 0, -strlen($comma));
     return $sql . " )";
 }
开发者ID:saiber,项目名称:www,代码行数:37,代码来源:ARSQLGenerator.php


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