Shanty Mongo is a mongodb library for the Zend Framework. Its intention is to make working with mongodb documents as natural and as simple as possible. In particular allowing embedded documents to also have custom document classes.
Hi!
I have two Document set :
"step": [
{
"step": "aller de agadir a essaouira",
"deadline": "18-09-2013",
"contributor": {
"name": "iddriss",
"id": "125423165423",
"profilImg": "1346665127.jpg"
},
"comment": [
I want to save a new comment in step number 1 (for exemple)
I write this code :
$row = Application_Model_Objectif::find('50179b9bff48b39c07000000');
$new = $row->step(1)->comment->new();
$new->comment = 'comment';
$new->datec = date('d-m-Y h:m');
$new->author = array('name' => 'hassan',
'id' => '1545fdfdf454df',
'profilImg' => 'img1.jpg'
);
$row->step(1)->comment->addDocument($new);
}
$row->save();
but doesn't work!!
please help me how can save a new comment ?? and sorry for my english!!
thank you,,,
Hi! I have two Document set : "step": [ { "step": "aller de agadir a essaouira", "deadline": "18-09-2013", "contributor": { "name": "iddriss", "id": "125423165423", "profilImg": "1346665127.jpg" }, "comment": [
],
and I have my models : class Application_Model_Objectif extends Shanty_Mongo_Document {
protected static $_db = 'mybpartner'; protected static $_collection = 'objectif'; protected static $_requirements = array( 'comment' => 'DocumentSet', 'commentsc' => 'DocumentSet', 'step' => 'DocumentSet', 'step.$.comment' => 'DocumentSet' ); }
I want to save a new comment in step number 1 (for exemple) I write this code : $row = Application_Model_Objectif::find('50179b9bff48b39c07000000'); $new = $row->step(1)->comment->new(); $new->comment = 'comment'; $new->datec = date('d-m-Y h:m'); $new->author = array('name' => 'hassan', 'id' => '1545fdfdf454df', 'profilImg' => 'img1.jpg' ); $row->step(1)->comment->addDocument($new); }
but doesn't work!! please help me how can save a new comment ?? and sorry for my english!! thank you,,,