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


PHP Author::reload方法代码示例

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


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

示例1: testInvalidCharset

 public function testInvalidCharset()
 {
     $this->markTestSkipped('Skipped because of weird behavior on some platforms');
     $db = Propel::getServiceContainer()->getAdapter(BookPeer::DATABASE_NAME);
     if ($db instanceof SqliteAdapter) {
         $this->markTestSkipped();
     }
     $a = new Author();
     $a->setFirstName("Б.");
     $a->setLastName("АКУНИН");
     $a->save();
     $authorNameWindows1251 = iconv("utf-8", "windows-1251", $a->getLastName());
     $a->setLastName($authorNameWindows1251);
     // Different databases seem to handle invalid data differently (no surprise, I guess...)
     if ($db instanceof PgsqlAdapter) {
         try {
             $a->save();
             $this->fail("Expected an exception when saving non-UTF8 data to database.");
         } catch (Exception $x) {
             print $x;
         }
     } else {
         // No exception is thrown by MySQL ... (others need to be tested still)
         $a->save();
         $a->reload();
         $this->assertEquals("", $a->getLastName(), "Expected last_name to be empty (after inserting invalid charset data)");
     }
 }
开发者ID:norfil,项目名称:Propel2,代码行数:28,代码来源:CharacterEncodingTest.php

示例2: testSymfonyFormManyToOne

 public function testSymfonyFormManyToOne()
 {
     BookQuery::create()->deleteAll();
     AuthorQuery::create()->deleteAll();
     // We create a simple book and a simple Author and simply link them to each other before reloading them
     $book = new Book();
     $book->setISBN('012345');
     $book->setTitle('Propel Book');
     $author = new Author();
     $author->setFirstName('François');
     $author->setLastName('Z');
     $author->addBook($book);
     $author->save();
     $book->save();
     $author->reload(true);
     $book->reload(true);
     // Symfony is cloning the book object in a ManyToOne form with by_reference = false
     $book2 = clone $book;
     $author->removeBook($book);
     $author->addBook($book2);
     $author->save();
     $author->reload(true);
     $books = $author->getBooks();
     $this->assertCount(1, $books);
 }
开发者ID:SwissalpS,项目名称:Propel2,代码行数:25,代码来源:GeneratedObjectRelTest.php


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