当前位置: 首页>>代码示例>>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;未经允许,请勿转载。