sittercity/sprig

load() loads a row when primaryKey = 0 (but not when pk = integer nonexistent in db, like -1, or 785487)

Closed this issue · 2 comments

snrp commented

Steps to reproduce it:

my_site/posts/delete/0

action_delete($id)
{   
    $id = (int) $id;
    $post = Sprig::factory('post',array('id' => $id))->load();

if ($post->loaded()) { 
        //should not get here when $id = 0, but we do
        echo 'Deleteing post with title: '.$post->title.'<br /><br />';
}

Dirty quickfix:
$id = ( (int)$id ) > 0 ? (int)$id : -1 ;

Edit: Never mind, all issues will be transferred over to the official branch by github. Hold on and everything will happen automagically.

This should be fixed by 6a9c650