How does the model know that test is used? Is title unique or primary? You should be doing another query above hand checking to see if query is taken, if its not do another query and insert.
On Feb 25, 12:39 pm, Jim <[email protected]> wrote: > 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
