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


PHP Schema\AbstractSchemaManager类代码示例

本文整理汇总了PHP中Doctrine\DBAL\Schema\AbstractSchemaManager的典型用法代码示例。如果您正苦于以下问题:PHP AbstractSchemaManager类的具体用法?PHP AbstractSchemaManager怎么用?PHP AbstractSchemaManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __construct

 public function __construct(\Doctrine\DBAL\Schema\AbstractSchemaManager $schema_manager)
 {
     $this->schema_manager = $schema_manager;
     foreach ($schema_manager->listTables() as $table) {
         $this->tables[$table->getName()] = new TableInformation($this, $table);
     }
     foreach ($this->tables as $table) {
         $this->findRelationships($table);
     }
 }
开发者ID:alanedwardes,项目名称:carbo,代码行数:10,代码来源:SchemaInformation.php

示例2: generate

 /**
  * Create array of all the fields for a table
  *
  * @param string                                      $table Table Name
  * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema
  * @param string                                      $database
  *
  * @return array|bool
  */
 public function generate($table, $schema, $database)
 {
     $this->database = $database;
     $columns = $schema->listTableColumns($table);
     if (empty($columns)) {
         return false;
     }
     $indexParser = new IndexParser($table, $schema);
     $fields = $this->setEnum($this->getFields($columns, $indexParser), $table);
     $indexes = $this->getMultiFieldIndexes($indexParser);
     return array_merge($fields, $indexes);
 }
开发者ID:19peaches,项目名称:laravel-generator,代码行数:21,代码来源:FieldParser.php

示例3: generate

 /**
  * Create array of all the fields for a table
  *
  * @param string                                      $table Table Name
  * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema
  * @param string                                      $database
  * @param bool                                        $ignoreIndexNames
  *
  * @return array
  */
 public function generate($table, $schema, $database, $ignoreIndexNames)
 {
     $this->database = $database;
     $columns = $schema->listTableColumns($table);
     if (empty($columns)) {
         return [];
     }
     $indexGenerator = new IndexGenerator($table, $schema, $ignoreIndexNames);
     $fields = $this->setEnum($this->getFields($columns, $indexGenerator), $table);
     $fields = $this->getMultiFieldIndexes($fields, $indexGenerator);
     return $fields;
 }
开发者ID:mayconbordin,项目名称:laragen,代码行数:22,代码来源:FieldGenerator.php

示例4: saveSchemaToFile

 /**
  * @param $file
  * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $sm
  * @return bool
  */
 public static function saveSchemaToFile($file, $sm)
 {
     $xml = new SimpleXMLElement('<database/>');
     $xml->addChild('name', OC_Config::getValue("dbname", "owncloud"));
     $xml->addChild('create', 'true');
     $xml->addChild('overwrite', 'false');
     $xml->addChild('charset', 'utf8');
     foreach ($sm->listTables() as $table) {
         self::saveTable($table, $xml->addChild('table'));
     }
     file_put_contents($file, $xml->asXML());
     return true;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:18,代码来源:mdb2schemawriter.php

示例5: generate

 /**
  * Get array of foreign keys
  *
  * @param string                                      $table Table Name
  * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema
  *
  * @return array
  */
 public function generate($table, $schema)
 {
     $this->table = $table;
     $fields = [];
     $foreignKeys = $schema->listTableForeignKeys($table);
     if (empty($foreignKeys)) {
         return array();
     }
     foreach ($foreignKeys as $foreignKey) {
         $fields[] = ['name' => $this->getName($foreignKey), 'field' => $foreignKey->getLocalColumns()[0], 'references' => $foreignKey->getForeignColumns()[0], 'on' => $foreignKey->getForeignTableName(), 'onUpdate' => $foreignKey->hasOption('onUpdate') ? $foreignKey->getOption('onUpdate') : 'RESTRICT', 'onDelete' => $foreignKey->hasOption('onDelete') ? $foreignKey->getOption('onDelete') : 'RESTRICT'];
     }
     return $fields;
 }
开发者ID:Goopil,项目名称:laravel-generator,代码行数:21,代码来源:ForeignKeyParser.php

示例6: generate

 /**
  * Create array of all the fields for a table
  *
  * @param string                                      $table Table Name
  * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema
  * @param string                                      $database
  * @param bool                                        $ignoreIndexNames
  *
  * @return array|bool
  */
 public function generate($table, $schema, $database, $ignoreIndexNames)
 {
     $this->defaultConnection = DB::getDefaultConnection();
     $this->database = $database;
     $columns = $schema->listTableColumns($table);
     if (empty($columns)) {
         return false;
     }
     $indexGenerator = new IndexGenerator($table, $schema, $ignoreIndexNames);
     $fields = $this->setEnum($this->getFields($columns, $indexGenerator), $table);
     $fields = $this->getTableProperty($fields, $table);
     $indexes = $this->getMultiFieldIndexes($indexGenerator);
     return array_merge($fields, $indexes);
 }
开发者ID:JosefMor,项目名称:migrations-generator,代码行数:24,代码来源:FieldGenerator.php

示例7: __construct

 /**
  * @param string                                      $table Table Name
  * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema
  * @param bool                                        $ignoreIndexNames
  */
 public function __construct($table, $schema)
 {
     $this->indexes = array();
     $this->multiFieldIndexes = array();
     $indexes = $schema->listTableIndexes($table);
     foreach ($indexes as $index) {
         $indexArray = $this->indexToArray($table, $index);
         if (count($indexArray['columns']) == 1) {
             $columnName = $indexArray['columns'][0];
             $this->indexes[$columnName] = (object) $indexArray;
         } else {
             $this->multiFieldIndexes[] = (object) $indexArray;
         }
     }
 }
开发者ID:19peaches,项目名称:laravel-generator,代码行数:20,代码来源:IndexParser.php

示例8: testCompositeForeignKeys

 public function testCompositeForeignKeys()
 {
     $this->conn->expects($this->once())->method('fetchAll')->will($this->returnValue($this->getFKDefinition()));
     $fkeys = $this->manager->listTableForeignKeys('dummy');
     $this->assertEquals(1, count($fkeys), "Table has to have one foreign key.");
     $this->assertInstanceOf('Doctrine\\DBAL\\Schema\\ForeignKeyConstraint', $fkeys[0]);
     $this->assertEquals(array('column_1', 'column_2', 'column_3'), array_map('strtolower', $fkeys[0]->getLocalColumns()));
     $this->assertEquals(array('column_1', 'column_2', 'column_3'), array_map('strtolower', $fkeys[0]->getForeignColumns()));
 }
开发者ID:barbondev,项目名称:mysql4-doctrine-driver,代码行数:9,代码来源:MySQL4SchemaManagerTest.php

示例9: getForeignKeyConstraint

 /**
  * @param string $table
  * @param string $column
  * @return string
  * @throws \Exception
  */
 private function getForeignKeyConstraint($table, $column)
 {
     $keys = $this->schemaManager->listTableForeignKeys($table);
     foreach ($keys as $key) {
         if (in_array($column, $key->getLocalColumns(), false)) {
             return $key->getName();
         }
     }
     throw new \Exception('Foreign key constraint not found.');
 }
开发者ID:shopwareLabs,项目名称:SwagImportExport,代码行数:16,代码来源:Update02RemoveForeignKeyConstraint.php

示例10: onSuccess

 public function onSuccess(Form $form)
 {
     if (!Callback::create($this->checkConnection)->invoke() || !$this->schemaManager->tablesExist('users')) {
         return;
     }
     $presenter = $form->presenter;
     $logEntity = new LogEntity($this->user instanceof UserEntity ? $this->user : NULL, 'Venne\\Forms\\Form', NULL, LogEntity::ACTION_OTHER);
     $logEntity->setType($presenter->link('this'));
     $logEntity->setMessage('Configuration has been updated');
     $this->logRepository->save($logEntity);
 }
开发者ID:svobodni,项目名称:web,代码行数:11,代码来源:FormLogListener.php

示例11: __construct

 public function __construct()
 {
     $this->schema = DB::getDoctrineSchemaManager();
     $this->schema->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
     $this->tables = $this->schema->listTables();
     $this->relationships = [];
     //first create empty ruleset for each table
     foreach ($this->tables as $table) {
         $this->relationships[$table->getName()] = ['hasMany' => [], 'hasOne' => [], 'belongsTo' => [], 'belongsToMany' => []];
     }
     // get all relationships into $this->relationships variable
     $this->getAllRelationships();
 }
开发者ID:Goopil,项目名称:laravel-generator,代码行数:13,代码来源:ModelRelationshipsGenerator.php

示例12: __construct

 /**
  * constructor
  * @param string $table_name
  * @param Connection $conn
  */
 public function __construct($table_name, \Doctrine\DBAL\Connection $conn)
 {
     $this->conn = $conn;
     $this->table_name = $table_name;
     $this->quoted_table_name = $this->conn->quoteIdentifier($this->table_name);
     $this->sm = $this->conn->getSchemaManager();
     if (!$this->sm->tablesExist([$table_name])) {
         throw Schema\SchemaException::tableDoesNotExist($table_name);
     }
     foreach ($this->sm->listTableColumns($this->table_name) as $colum) {
         $this->columns[$colum->getName()] = $colum;
         $this->column_types[$colum->getName()] = $colum->getType()->getName();
     }
 }
开发者ID:schwaen,项目名称:doctrine-dbal-extensions,代码行数:19,代码来源:Model.php

示例13: migrate

 /**
  * Migrates the database.
  *
  * @return Schema
  */
 public function migrate()
 {
     $diff = Comparator::compareSchemas($this->manager->createSchema(), $this->schema);
     foreach ($diff->toSaveSql($this->connection->getDatabasePlatform()) as $query) {
         $this->connection->executeQuery($query);
     }
 }
开发者ID:pagekit,项目名称:pagekit,代码行数:12,代码来源:Utility.php

示例14: executeChanges

 /**
  * Execute changes
  */
 public function executeChanges()
 {
     $platform = $this->sm->getDatabasePlatform();
     $sql = [];
     if (count($this->changedIndexes)) {
         foreach ($this->changedIndexes as $index) {
             $sql[] = $platform->getDropIndexSQL($index);
             $sql[] = $platform->getCreateIndexSQL($index, $this->table);
         }
     }
     if (count($this->dropIndexes)) {
         foreach ($this->dropIndexes as $index) {
             $sql[] = $platform->getDropIndexSQL($index);
         }
     }
     if (count($this->addedIndexes)) {
         foreach ($this->addedIndexes as $index) {
             $sql[] = $platform->getCreateIndexSQL($index, $this->table);
         }
     }
     if (count($sql)) {
         foreach ($sql as $query) {
             $this->db->executeUpdate($query);
         }
         $this->changedIndexes = [];
         $this->dropIndexes = [];
         $this->addedIndexes = [];
     }
 }
开发者ID:Yame-,项目名称:mautic,代码行数:32,代码来源:IndexSchemaHelper.php

示例15: get_views

 /**
  * Gets array \Doctrine\DBAL\Schema\View
  *
  * @return array
  */
 public function get_views()
 {
     /**
      * get views
      */
     $views = $this->sm->listViews();
     return $views;
 }
开发者ID:mp-php,项目名称:fuel-packages-dbdocs,代码行数:13,代码来源:dbdocs.php


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