Cakephp Insert Ignore Feature?

Posted by SeanDowney on Stack Overflow See other posts from Stack Overflow or by SeanDowney
Published on 2010-05-13T22:45:07Z Indexed on 2010/05/14 1:14 UTC
Read the original article Hit count: 384

Filed under:
|
|

Is there a way to do an "insert ignore" in cake without using a model->query function?

            $this->Model->save(array(
                'id' => NULL,
                'guid' => $guid,
                'name' => $name,
            ));

Generates error:

Warning (512): SQL Error: 1062: Duplicate entry 'GUID.....' for key 'unique_guid' [CORE/cake/libs/model/datasources/dbo_source.php, line 524]

It would be great to be able to set some flag or option that says "don't care"

© Stack Overflow or respective owner

Related posts about cakephp

Related posts about insert