本文整理匯總了PHP中Thumbnail::findFirstBy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Thumbnail::findFirstBy方法的具體用法?PHP Thumbnail::findFirstBy怎麽用?PHP Thumbnail::findFirstBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Thumbnail
的用法示例。
在下文中一共展示了Thumbnail::findFirstBy方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Picture
function test_for_multiple_hasone_and_belongsto()
{
$Altea =& new Picture(array('title'=>'Altea Cupula de Mediterraneo, Costa Blanca'));
$Altea->main_thumbnail->build(array('caption'=>'Altea'));
$this->assertTrue($Altea->main_thumbnail->isNewRecord());
$this->assertEqual($Altea->main_thumbnail->getType(), 'Thumbnail');
$this->assertTrue($Altea->save());
$this->assertFalse($Altea->main_thumbnail->isNewRecord());
$Altea =& new Picture(array('title'=>'Altea2'));
$Altea->main_thumbnail->create(array('caption'=>'Altea2'));
$this->assertFalse($Altea->main_thumbnail->isNewRecord());
$this->assertEqual($Altea->main_thumbnail->getType(), 'Thumbnail');
$this->assertTrue($Altea->save());
$Altea =& new Picture(array('title'=>'Altea3'));
$Altea->main_thumbnail->assign(new Thumbnail(array('caption'=>'Altea3')));
$this->assertTrue($Altea->main_thumbnail->isNewRecord());
$this->assertEqual($Altea->main_thumbnail->getType(), 'Thumbnail');
$this->assertTrue($Altea->save());
$this->assertFalse($Altea->main_thumbnail->isNewRecord());
$Altea->main_thumbnail->replace(new Thumbnail(array('caption'=>'3rd Altea pic')));
$this->assertFalse($Altea->main_thumbnail->isNewRecord());
$Thumbnail = new Thumbnail();
$this->assertFalse($Thumbnail->findFirstBy('caption','Altea3'));
$Panorama =& new Panorama(array('title'=>'Views from the old town'));
$this->assertTrue($Panorama->save());
$Panorama->thumbnail->build(array('caption'=>'Altea paronamic views from the Old town'));
$this->assertEqual($Panorama->thumbnail->getType(), 'Thumbnail');
$this->assertTrue($Panorama->thumbnail->isNewRecord());
$this->assertTrue($Panorama->save());
$this->assertFalse($Panorama->thumbnail->isNewRecord());
$Thumbnail =& new Thumbnail();
$Thumbnail = $Thumbnail->findFirstBy('caption:has', 'Old town', array('include'=>'panorama'));
$this->assertEqual($Thumbnail->panorama->title, 'Views from the old town');
}