本文整理汇总了PHP中ThePaper::findById方法的典型用法代码示例。如果您正苦于以下问题:PHP ThePaper::findById方法的具体用法?PHP ThePaper::findById怎么用?PHP ThePaper::findById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThePaper
的用法示例。
在下文中一共展示了ThePaper::findById方法的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']);
}
示例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']);
}