Permalink
Browse files

set primaryKey in Model files of sample

  • Loading branch information...
ichikaway committed Aug 24, 2011
1 parent dab3e1a commit bf68bdcdbafc40c3123e662b72af32aab006abd9
@@ -68,7 +68,6 @@ public function edit($id = null) {
$this->flash(__('Invalid Post', true), array('action' => 'index'));
}
if (!empty($this->data)) {
- $this->Post->id = $id;
if ($this->Post->save($this->data)) {
$this->flash(__('The Post has been saved.', true), array('action' => 'index'));
} else {
@@ -60,7 +60,6 @@ public function edit($id = null) {
$this->flash(__('Invalid Subdocument', true), array('action' => 'index'));
}
if (!empty($this->data)) {
- $this->Subdocument->id = $id;
if ($this->Subdocument->save($this->data)) {
$this->flash(__('The Subdocument has been saved.', true), array('action' => 'index'));
} else {
View
@@ -1,6 +1,7 @@
<?php
class Post extends AppModel {
+ public $primaryKey = '_id';
//var $useDbConfig = 'mongo';
/*
var $mongoSchema = array(
@@ -1,5 +1,6 @@
<?php
class Subdocument extends AppModel {
+ public $primaryKey = '_id';
/*
var $mongoSchema = array(
'title' => array('type'=>'string'),

0 comments on commit bf68bdc

Please sign in to comment.