#96 open
Joshua Paine

$modelObj->save() fails if $model is new and has its primary key set

Reported by Joshua Paine | April 21st, 2009 @ 03:12 PM | in 0.30

Manually setting a value for the primary key on a new model object means that $modelObj->save() will perform an update instead of an insert even if $modelObj has never been saved to the DB. Models probably need to keep a protected flag about whether they've been saved or not instead.

Comments and changes to this ticket

  • Kris Jordan

    Kris Jordan June 9th, 2009 @ 02:36 PM

    • State changed from “new” to “open”
    • Milestone changed from 0.20 to 0.30

    Moving this to 0.3 as it is model related and is related to the fix for cascading the delete of graph of rows in the correct order. Would love to see the fix for this be something that happens last minute (like adding a SELECT 1 AS _exists) and during PDO's retrieval.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Recess PHP Framework is an open source, full stack, RESTful PHP framework.


People watching this ticket