Thursday, February 25, 2010

My starred items My posts My personal settings Use my other account... Logout cakephp shell not validating before entering into db?

Hello,

I have a model called Issue, which when its associated controller and
views are visited on a webpage, (.../issues/add, e.g.) checks for
unique titles and won't submit duplicate entries with the same title
(I have been testing this with entries with 'test' as title). Works
fine on that end, but for some reason, I have the same thing going on
in a shell script, and it doesn't validate (check for unique title
names) before submitting the title entry. Is there some kind of
disconnect between some of the model functions and the shell script
that I'm not aware of? Below is my shell script. Any help would be
greatly appreciated!

-Jim

---

<?php

class TestShell extends Shell {

var $uses = array('Issue');

function main() { }

function issues() {
$this->Issue->create();
$this->Issue->save(array('title' => 'test')); //
because there's already an entry with this title, it shouldn't save...
but does.
}

}

?>

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en

No comments: