本文整理汇总了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');
}