當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Thumbnail::findFirstBy方法代碼示例

本文整理匯總了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');
    }
開發者ID:joeymetal,項目名稱:v1,代碼行數:43,代碼來源:AkBelongsTo.php


注:本文中的Thumbnail::findFirstBy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。