當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。