Tuesday, March 29, 2011

saveAll and validate=>only

i would expect saveAll to return either true or false
but instead it returns an array with the individual results

so i cannot use something like

if ($x = $this->BoardTopic->saveAll($this->data['BoardTopic'],
array('validate'=>'only'))) {
...
}

how do you do that?
loop over the result first to decide whether you can continue? seems a
little bit odd to be:

$x = $this->BoardTopic->saveAll($this->data['BoardTopic'],
array('validate'=>'only'));
$ok = true;
foreach ($x as $result) {
if (!$result) { $ok = false; break; }
}
if (!empty($ok))) {
...
}

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: