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


PHP Table::deleteAll方法代码示例

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


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

示例1: beforeDelete

 /**
  * Also deletes the nodes in the subtree of the entity to be delete
  *
  * @param \Cake\Event\Event the beforeDelete event that was fired
  * @param \Cake\ORM\Entity the entity that is going to be saved
  * @return void
  */
 public function beforeDelete(Event $event, Entity $entity)
 {
     $config = $this->config();
     $this->_ensureFields($entity);
     $left = $entity->get($config['left']);
     $right = $entity->get($config['right']);
     $diff = $right - $left + 1;
     if ($diff > 2) {
         $this->_table->deleteAll(["{$config['left']} >=" => $left + 1, "{$config['left']} <=" => $right - 1]);
     }
     $this->_sync($diff, '-', "> {$right}");
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:19,代码来源:TreeBehavior.php

示例2: testDeleteAllAliasedConditions

 /**
  * Test deleting many records with conditions using the alias
  *
  * @return void
  */
 public function testDeleteAllAliasedConditions()
 {
     $table = new Table(['table' => 'users', 'alias' => 'Managers', 'connection' => $this->connection]);
     $result = $table->deleteAll(['Managers.id <' => 4]);
     $this->assertSame(3, $result);
     $result = $table->find('all')->toArray();
     $this->assertCount(1, $result, 'Only one record should remain');
     $this->assertEquals(4, $result[0]['id']);
 }
开发者ID:jdaosavanh,项目名称:clickerwebapp,代码行数:14,代码来源:TableTest.php

示例3: gc

 /**
  * Helper function called on gc for database sessions.
  *
  * @param string $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed.
  * @return bool True on success, false on failure.
  */
 public function gc($maxlifetime)
 {
     $this->_table->deleteAll(['expires <' => time()]);
     return true;
 }
开发者ID:thanghexp,项目名称:project,代码行数:11,代码来源:DatabaseSession.php

示例4: cleanDrafts

 /**
  * Delete all draft entries in database
  * 
  * @param \Cake\ORM\Table $table Table instance
  * 
  * @return bool
  */
 public function cleanDrafts(Table $table)
 {
     return $table->deleteAll(['online' => -1]);
 }
开发者ID:romano83,项目名称:cakephp3-draft,代码行数:11,代码来源:DraftBehavior.php

示例5: gc

 /**
  * Helper function called on gc for database sessions.
  *
  * @param string $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed.
  * @return bool True on success, false on failure.
  */
 public function gc($maxlifetime)
 {
     return $this->_table->deleteAll(['expires <' => time() - $maxlifetime]);
 }
开发者ID:neilan35,项目名称:betterwindow1,代码行数:10,代码来源:DatabaseSession.php


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