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


PHP ThePaper::save方法代码示例

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


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

示例1: testHabtmSaveKeyResolution

 /**
  * testHabtmSaveKeyResolution method
  *
  * @return void
  */
 public function testHabtmSaveKeyResolution()
 {
     $this->loadFixtures('Apple', 'Device', 'ThePaperMonkies');
     $ThePaper = new ThePaper();
     $ThePaper->id = 1;
     $ThePaper->save(array('Monkey' => array(2, 3)));
     $result = $ThePaper->findById(1);
     $expected = array(array('id' => '2', 'device_type_id' => '1', 'name' => 'Device 2', 'typ' => '1'), array('id' => '3', 'device_type_id' => '1', 'name' => 'Device 3', 'typ' => '2'));
     $this->assertEquals($expected, $result['Monkey']);
     $ThePaper->id = 2;
     $ThePaper->save(array('Monkey' => array(1, 2, 3)));
     $result = $ThePaper->findById(2);
     $expected = array(array('id' => '1', 'device_type_id' => '1', 'name' => 'Device 1', 'typ' => '1'), array('id' => '2', 'device_type_id' => '1', 'name' => 'Device 2', 'typ' => '1'), array('id' => '3', 'device_type_id' => '1', 'name' => 'Device 3', 'typ' => '2'));
     $this->assertEquals($expected, $result['Monkey']);
     $ThePaper->id = 2;
     $ThePaper->save(array('Monkey' => array(1, 3)));
     $result = $ThePaper->findById(2);
     $expected = array(array('id' => '1', 'device_type_id' => '1', 'name' => 'Device 1', 'typ' => '1'), array('id' => '3', 'device_type_id' => '1', 'name' => 'Device 3', 'typ' => '2'));
     $this->assertEquals($expected, $result['Monkey']);
     $result = $ThePaper->findById(1);
     $expected = array(array('id' => '2', 'device_type_id' => '1', 'name' => 'Device 2', 'typ' => '1'), array('id' => '3', 'device_type_id' => '1', 'name' => 'Device 3', 'typ' => '2'));
     $this->assertEquals($expected, $result['Monkey']);
 }
开发者ID:manzapanza,项目名称:cakephp-api-utils,代码行数:28,代码来源:ModelWriteTest.php

示例2: testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable

 /**
  * testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable method
  *
  * @return void
  */
 public function testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable()
 {
     $this->loadFixtures('Apple', 'Device', 'ThePaperMonkies');
     $ThePaper = new ThePaper();
     $ThePaper->id = 1;
     $ThePaper->save(array('Monkey' => array(2, 3)));
     $result = $ThePaper->findById(1);
     $expected = array(array('id' => '2', 'device_type_id' => '1', 'name' => 'Device 2', 'typ' => '1'), array('id' => '3', 'device_type_id' => '1', 'name' => 'Device 3', 'typ' => '2'));
     $this->assertEquals($expected, $result['Monkey']);
     $ThePaper = new ThePaper();
     $ThePaper->id = 2;
     $ThePaper->save(array('Monkey' => array(2, 3)));
     $result = $ThePaper->findById(2);
     $expected = array(array('id' => '2', 'device_type_id' => '1', 'name' => 'Device 2', 'typ' => '1'), array('id' => '3', 'device_type_id' => '1', 'name' => 'Device 3', 'typ' => '2'));
     $this->assertEquals($expected, $result['Monkey']);
     $ThePaper->delete(1);
     $result = $ThePaper->findById(2);
     $expected = array(array('id' => '2', 'device_type_id' => '1', 'name' => 'Device 2', 'typ' => '1'), array('id' => '3', 'device_type_id' => '1', 'name' => 'Device 3', 'typ' => '2'));
     $this->assertEquals($expected, $result['Monkey']);
 }
开发者ID:pritten,项目名称:SmartCitizen.me,代码行数:25,代码来源:ModelDeleteTest.php


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