本文整理汇总了PHP中Something::saveMany方法的典型用法代码示例。如果您正苦于以下问题:PHP Something::saveMany方法的具体用法?PHP Something::saveMany怎么用?PHP Something::saveMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Something
的用法示例。
在下文中一共展示了Something::saveMany方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSaveManyValidateFirstAtomicFalse
/**
* test saveMany()'s return is correct when using atomic = false and validate = first.
*
* @return void
*/
public function testSaveManyValidateFirstAtomicFalse()
{
$Something = new Something();
$invalidData = array(array('title' => 'foo', 'body' => 'bar', 'published' => 'baz'), array('body' => 3, 'published' => 'sd'));
$Something->create();
$Something->validate = array('title' => array('rule' => 'alphaNumeric', 'required' => true), 'body' => array('rule' => 'alphaNumeric', 'required' => true, 'allowEmpty' => true));
$result = $Something->saveMany($invalidData, array('atomic' => false, 'validate' => 'first'));
$expected = array(true, false);
$this->assertEquals($expected, $result);
$Something = new Something();
$validData = array(array('title' => 'title value', 'body' => 'body value', 'published' => 'baz'), array('title' => 'valid', 'body' => 'this body', 'published' => 'sd'));
$Something->create();
$result = $Something->saveMany($validData, array('atomic' => false, 'validate' => 'first'));
$expected = array(true, true);
$this->assertEquals($expected, $result);
}