当前位置: 首页>>代码示例>>PHP>>正文


PHP Thumbnail::isNewRecord方法代码示例

本文整理汇总了PHP中Thumbnail::isNewRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP Thumbnail::isNewRecord方法的具体用法?PHP Thumbnail::isNewRecord怎么用?PHP Thumbnail::isNewRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Thumbnail的用法示例。


在下文中一共展示了Thumbnail::isNewRecord方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_for_belongs_to_association

 public function test_for_belongs_to_association()
 {
     $Thumbnail = new Thumbnail();
     $Thumbnail = $Thumbnail->findFirstBy('caption', 'Lucky (our pet)');
     $Thumbnail = new Thumbnail($Thumbnail->getId());
     $this->assertEqual($Thumbnail->picture->getType(), 'belongsTo');
     $Thumbnail = $Thumbnail->findFirstBy('caption:has', 'Lucky', array('include' => 'picture'));
     $this->assertEqual($Thumbnail->picture->getType(), 'Picture');
     $this->assertEqual($Thumbnail->picture->title, 'The Akelos Media Team at Carlet');
     $Alicia = $Thumbnail->create('caption->', 'Alicia');
     $this->assertTrue(!$Alicia->isNewRecord());
     $this->assertEqual($Alicia->picture->getType(), 'belongsTo');
     $MyGirl = new Picture(array('title' => 'Alicia Sadurní'));
     $Alicia->picture->assign($MyGirl);
     $this->assertEqual($Alicia->picture->getType(), 'Picture');
     $this->assertReference($Alicia->picture, $MyGirl);
     $this->assertFalse($MyGirl->isNewRecord());
     $this->assertEqual($Alicia->get('photo_id'), $MyGirl->getId());
     $this->assertTrue($Alicia->save());
     $Thumbnail = new Thumbnail();
     $Thumbnail->caption = 'Party 2005';
     $Picture = $Thumbnail->picture->build(array('title' => 'Akelos Party 2005'));
     $this->assertReference($Thumbnail->picture, $Picture);
     $this->assertEqual($Picture->getType(), 'Picture');
     $this->assertTrue($Picture->isNewRecord() && $Thumbnail->isNewRecord());
     $this->assertTrue($Thumbnail->save());
     $this->assertFalse($Picture->isNewRecord());
     $this->assertFalse($Thumbnail->isNewRecord());
     $Thumbnail = new Thumbnail();
     $Thumbnail->caption = 'Party 2006';
     $Picture = $Thumbnail->picture->create(array('title' => 'Akelos Party 2006'));
     $this->assertReference($Thumbnail->picture, $Picture);
     $this->assertEqual($Picture->getType(), 'Picture');
     $this->assertFalse($Picture->isNewRecord());
     $this->assertTrue($Thumbnail->isNewRecord());
     $Thumbnail = new Thumbnail(array('title' => 'Akelos new office'));
     $Thumbnail->loadAssociations();
     $Thumbnail->picture->assign($Picture);
     $this->assertTrue($Thumbnail->save());
     $this->assertEqual($Thumbnail->photo_id, $Picture->id);
 }
开发者ID:joeymetal,项目名称:v1,代码行数:41,代码来源:AkBelongsTo.php


注:本文中的Thumbnail::isNewRecord方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。