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


PHP TableRegistry::remove方法代码示例

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


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

示例1: init

 public function init()
 {
     parent::init();
     // 1. Not all fixtures want to use the dev db.
     if (is_null($this->tableName)) {
         return;
     }
     // 2. We need to do this to ensure that the tables really do use the connection to the
     // dev db.
     TableRegistry::remove($this->tableName);
     $table = TableRegistry::get($this->tableName, ['connection' => ConnectionManager::get('dev')]);
     //if(!is_null($this->joinTableName)) {
     //TableRegistry::remove($this->joinTableName);
     //$n=TableRegistry::get($this->joinTableName, ['connection' => ConnectionManager::get('fixture')]);
     //}
     // 3. Now build the query to retrieve the source records
     $query = new Query(ConnectionManager::get('dev'), $table);
     $query->find('all');
     //if(!is_null($this->order)) $query->order($this->order);
     //if(!is_null($this->joinTableName)) $query->leftJoin($this->joinTableName,'semesters.id = sections.semester_id');
     //$c=$query->count();
     // 4. Copy the records
     /* @var \Cake\ORM\Entity $record */
     foreach ($query as $record) {
         $this->records[] = $record->toArray();
     }
     // 5. Do this again to ensure that the table uses the 'test' connection.
     TableRegistry::remove($this->tableName);
     TableRegistry::get($this->tableName, ['connection' => ConnectionManager::get('test')]);
     //if(!is_null($this->joinTableName)) {
     //TableRegistry::remove($this->joinTableName);
     //TableRegistry::get($this->joinTableName, ['connection' => ConnectionManager::get('test')]);
     //}
 }
开发者ID:bostontrader,项目名称:duncemaster,代码行数:34,代码来源:DMFixture.php

示例2: tearDown

 /**
  * tearDown() method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     ini_set('intl.default_locale', $this->default_locale);
     unset($this->Items);
     TableRegistry::remove('Items');
 }
开发者ID:jmjjg,项目名称:cakephp-database,代码行数:12,代码来源:FormattableBehaviorTest.php

示例3: startup

 /**
  * Override startup of the Shell
  *
  * @return void
  */
 public function startup()
 {
     parent::startup();
     if (isset($this->params['connection'])) {
         $this->connection = $this->params['connection'];
     }
     $class = Configure::read('Acl.classname');
     $className = App::classname('Acl.' . $class, 'Adapter');
     if ($class !== 'DbAcl' && !is_subclass_of($className, 'Acl\\Adapter\\DbAcl')) {
         $out = "--------------------------------------------------\n";
         $out .= __d('cake_acl', 'Error: Your current CakePHP configuration is set to an ACL implementation other than DB.') . "\n";
         $out .= __d('cake_acl', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n";
         $out .= "--------------------------------------------------\n";
         $out .= __d('cake_acl', 'Current ACL Classname: {0}', [$class]) . "\n";
         $out .= "--------------------------------------------------\n";
         $this->err($out);
         return $this->_stop();
     }
     if ($this->command) {
         if (Configure::check('Datasource') === null) {
             $this->out(__d('cake_acl', 'Your database configuration was not found. Take a moment to create one.'));
             $this->args = null;
             return $this->DbConfig->execute();
         }
         try {
             \Cake\ORM\TableRegistry::get('Aros')->schema();
             \Cake\ORM\TableRegistry::remove('Aros');
         } catch (\Cake\Database\Exception $e) {
             $this->out(__d('cake_acl', 'Acl database tables not found. To create them, run:'));
             $this->out();
             $this->out('  bin/cake Migrations.migrations migrate -p Acl');
             $this->out();
             return $this->_stop();
         }
         $registry = new ComponentRegistry();
         $this->Acl = new AclComponent($registry);
         $controller = new Controller();
     }
 }
开发者ID:rochamarcelo,项目名称:acl,代码行数:44,代码来源:AclShell.php

示例4: tearDown

 public function tearDown()
 {
     TableRegistry::remove('Messages');
     TableRegistry::remove('Threads');
     TableRegistry::remove('MessageReadStatuses');
 }
开发者ID:gintonicweb,项目名称:messages,代码行数:6,代码来源:ThreadsControllerTest.php

示例5: testRemove

 /**
  * Tests remove an instance
  *
  * @return void
  */
 public function testRemove()
 {
     Plugin::load('TestPlugin');
     $pluginTable = TableRegistry::get('TestPlugin.Comments');
     $cachedTable = TableRegistry::get('Comments');
     $this->assertTrue(TableRegistry::exists('Comments'));
     $this->assertSame($pluginTable, $cachedTable);
     TableRegistry::remove('Comments');
     $this->assertFalse(TableRegistry::exists('Comments'));
     $appTable = TableRegistry::get('Comments');
     $this->assertTrue(TableRegistry::exists('Comments'));
     $this->assertNotSame($pluginTable, $appTable);
 }
开发者ID:neilan35,项目名称:betterwindow1,代码行数:18,代码来源:TableRegistryTest.php

示例6: testRemovePlugin

 /**
  * testRemovePlugin
  *
  * Removing a plugin-prefixed model should not affect any other
  * plugin-prefixed model, or app model.
  * Removing an app model should not affect any other
  * plugin-prefixed model.
  *
  * @return void
  */
 public function testRemovePlugin()
 {
     Plugin::load('TestPlugin');
     Plugin::load('TestPluginTwo');
     $app = TableRegistry::get('Comments');
     TableRegistry::get('TestPlugin.Comments');
     $plugin = TableRegistry::get('TestPluginTwo.Comments');
     $this->assertTrue(TableRegistry::exists('Comments'));
     $this->assertTrue(TableRegistry::exists('TestPlugin.Comments'));
     $this->assertTrue(TableRegistry::exists('TestPluginTwo.Comments'));
     TableRegistry::remove('TestPlugin.Comments');
     $this->assertTrue(TableRegistry::exists('Comments'));
     $this->assertFalse(TableRegistry::exists('TestPlugin.Comments'));
     $this->assertTrue(TableRegistry::exists('TestPluginTwo.Comments'));
     $app2 = TableRegistry::get('Comments');
     $plugin2 = TableRegistry::get('TestPluginTwo.Comments');
     $this->assertSame($app, $app2, 'Should be the same Comments object');
     $this->assertSame($plugin, $plugin2, 'Should be the same TestPluginTwo.Comments object');
     TableRegistry::remove('Comments');
     $this->assertFalse(TableRegistry::exists('Comments'));
     $this->assertFalse(TableRegistry::exists('TestPlugin.Comments'));
     $this->assertTrue(TableRegistry::exists('TestPluginTwo.Comments'));
     $plugin3 = TableRegistry::get('TestPluginTwo.Comments');
     $this->assertSame($plugin, $plugin3, 'Should be the same TestPluginTwo.Comments object');
 }
开发者ID:RogerSchmeier,项目名称:Webtruck,代码行数:35,代码来源:TableRegistryTest.php

示例7: tearDown

 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     unset($this->News);
     TableRegistry::remove('CkTools.News');
     parent::tearDown();
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:11,代码来源:SortableBehaviorTest.php

示例8: getAttachedTables

 /**
  * Vrátí tabulky s chováním, které se mají indexovat
  * Return tables with behavior which should be indexed
  *
  *
  * @param bool $indexedByName Pass true if names should be returned instead of Tables
  *
  * @return array
  */
 public function getAttachedTables($indexedByName = false)
 {
     $modelPath = 'Model' . DS . 'Table';
     $modelPath = APP . $modelPath;
     $tables = [];
     foreach ((new Folder($modelPath))->find('.*.php') as $file) {
         $table = str_replace('Table.php', '', $file);
         if (TableRegistry::exists($table)) {
             TableRegistry::remove($table);
         }
         $tableTable = TableRegistry::get($table, ['options' => ['skipSimilarInitialize' => true]]);
         if ($tableTable->hasBehavior('InRelatedIndex')) {
             if ($indexedByName) {
                 $tables[$table] = $tableTable;
             } else {
                 $tables[] = $tableTable;
             }
         }
     }
     return $tables;
 }
开发者ID:aiphee,项目名称:cakephp-related-content,代码行数:30,代码来源:InRelatedIndexBehavior.php

示例9: testRemove

 /**
  * Test the remove() method.
  *
  * @return void
  */
 public function testRemove()
 {
     $locator = $this->_setMockLocator();
     $locator->expects($this->once())->method('remove')->with('Test');
     TableRegistry::remove('Test');
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:11,代码来源:TableRegistryTest.php


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