本文整理汇总了PHP中Story::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Story::set方法的具体用法?PHP Story::set怎么用?PHP Story::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Story
的用法示例。
在下文中一共展示了Story::set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSaveHabtmCustomKeys
/**
* testSaveHabtmCustomKeys method
*
* @return void
*/
public function testSaveHabtmCustomKeys()
{
$this->loadFixtures('Story', 'StoriesTag', 'Tag');
$Story = new Story();
$data = array('Story' => array('story' => '1'), 'Tag' => array('Tag' => array(2, 3)));
$result = $Story->set($data);
$this->assertFalse(empty($result));
$result = $Story->save();
$this->assertFalse(empty($result));
$result = $Story->find('all', array('order' => array('Story.story')));
$expected = array(array('Story' => array('story' => 1, 'title' => 'First Story'), 'Tag' => array(array('id' => 2, 'tag' => 'tag2', 'created' => '2007-03-18 12:24:23', 'updated' => '2007-03-18 12:26:31'), array('id' => 3, 'tag' => 'tag3', 'created' => '2007-03-18 12:26:23', 'updated' => '2007-03-18 12:28:31'))), array('Story' => array('story' => 2, 'title' => 'Second Story'), 'Tag' => array()));
$this->assertEquals($expected, $result);
}