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


PHP BookTableMap::doDeleteAll方法代码示例

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


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

示例1: testFindOneWithSameRelatedObject

 /**
  * @see http://www.propelorm.org/ticket/959
  */
 public function testFindOneWithSameRelatedObject()
 {
     BookTableMap::doDeleteAll();
     AuthorTableMap::doDeleteAll();
     $auth = new Author();
     $auth->setFirstName('John');
     $auth->setLastName('Doe');
     $auth->save();
     $book1 = new Book();
     $book1->setTitle('Hello');
     $book1->setISBN('FA404');
     $book1->setAuthor($auth);
     $book1->save();
     $book2 = new Book();
     $book2->setTitle('World');
     $book2->setISBN('FA404');
     $book2->setAuthor($auth);
     $book2->save();
     BookTableMap::clearInstancePool();
     AuthorTableMap::clearInstancePool();
     $c = new ModelCriteria('bookstore', '\\Propel\\Tests\\Bookstore\\Book');
     $c->setFormatter(ModelCriteria::FORMAT_ARRAY);
     $c->join('Propel\\Tests\\Bookstore\\Book.Author');
     $c->with('Author');
     $books = $c->find();
     $this->assertEquals(2, count($books));
     $firstBook = $books[0];
     $this->assertTrue(isset($firstBook['Author']));
     $secondBook = $books[1];
     $this->assertTrue(isset($secondBook['Author']));
 }
开发者ID:badelas,项目名称:thelia,代码行数:34,代码来源:ArrayFormatterWithTest.php

示例2: testDebugLog

 public function testDebugLog()
 {
     $con = Propel::getServiceContainer()->getConnection(BookTableMap::DATABASE_NAME);
     // save data to return to normal state after test
     $logger = $con->getLogger();
     $logMethods = $con->getLogMethods();
     $testLog = new Logger('debug');
     $handler = new LastMessageHandler();
     $testLog->pushHandler($handler);
     $con->setLogger($testLog);
     $con->setLogMethods(['exec', 'query', 'execute', 'beginTransaction', 'commit', 'rollBack']);
     $con->useDebug(true);
     $con->beginTransaction();
     // test transaction log
     $this->assertEquals('Begin transaction', $handler->latestMessage, 'PropelPDO logs begin transaction in debug mode');
     $con->commit();
     $this->assertEquals('Commit transaction', $handler->latestMessage, 'PropelPDO logs commit transaction in debug mode');
     $con->beginTransaction();
     $con->rollBack();
     $this->assertEquals('Rollback transaction', $handler->latestMessage, 'PropelPDO logs rollback transaction in debug mode');
     $con->beginTransaction();
     $handler->latestMessage = '';
     $con->beginTransaction();
     $this->assertEquals('', $handler->latestMessage, 'PropelPDO does not log nested begin transaction in debug mode');
     $con->commit();
     $this->assertEquals('', $handler->latestMessage, 'PropelPDO does not log nested commit transaction in debug mode');
     $con->beginTransaction();
     $con->rollBack();
     $this->assertEquals('', $handler->latestMessage, 'PropelPDO does not log nested rollback transaction in debug mode');
     $con->rollback();
     // test query log
     $con->beginTransaction();
     $c = new Criteria();
     $c->add(BookTableMap::COL_TITLE, 'Harry%s', Criteria::LIKE);
     $books = BookQuery::create(null, $c)->find($con);
     $latestExecutedQuery = $this->getSql("SELECT book.id, book.title, book.isbn, book.price, book.publisher_id, book.author_id FROM book WHERE book.title LIKE 'Harry%s'");
     $this->assertEquals($latestExecutedQuery, $handler->latestMessage, 'PropelPDO logs queries and populates bound parameters in debug mode');
     BookTableMap::doDeleteAll($con);
     $latestExecutedQuery = $this->getSql("DELETE FROM book");
     $this->assertEquals($latestExecutedQuery, $handler->latestMessage, 'PropelPDO logs deletion queries in debug mode');
     $latestExecutedQuery = 'DELETE FROM book WHERE 1=1';
     $con->exec($latestExecutedQuery);
     $this->assertEquals($latestExecutedQuery, $handler->latestMessage, 'PropelPDO logs exec queries in debug mode');
     $con->commit();
     // return to normal state after test
     $con->setLogger($logger);
     $con->setLogMethods($logMethods);
 }
开发者ID:disider,项目名称:Propel2,代码行数:48,代码来源:PropelPDOTest.php

示例3: testDoDeleteAll_Cascade

 /**
  * Test the doDeleteAll() method when onDelete="CASCADE".
  */
 public function testDoDeleteAll_Cascade()
 {
     BookTableMap::doDeleteAll();
     $this->assertCount(0, MediaQuery::create()->find(), "Expect all media rows to have been cascade deleted.");
     $this->assertCount(0, ReviewQuery::create()->find(), "Expect all review rows to have been cascade deleted.");
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:9,代码来源:GeneratedQueryDoDeleteTest.php


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