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