本文整理汇总了PHP中Author::reload方法的典型用法代码示例。如果您正苦于以下问题:PHP Author::reload方法的具体用法?PHP Author::reload怎么用?PHP Author::reload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Author
的用法示例。
在下文中一共展示了Author::reload方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testInvalidCharset
public function testInvalidCharset()
{
$this->markTestSkipped();
$db = Propel::getDB(BookPeer::DATABASE_NAME);
if ($db instanceof DBSQLite) {
$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 DBPostgres) {
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)");
}
}
示例2: test_timestamps_set_before_save
public function test_timestamps_set_before_save()
{
$author = new Author();
$author->save();
$this->assert_not_null($author->created_at, $author->updated_at);
$author->reload();
$this->assert_not_null($author->created_at, $author->updated_at);
}
示例3: testTimestampsSetBeforeSave
public function testTimestampsSetBeforeSave()
{
$author = new Author();
$author->save();
$this->assertNotNull($author->created_at, $author->updated_at);
$author->reload();
$this->assertNotNull($author->created_at, $author->updated_at);
}