I am trying to use a Collection model to create a new record in Mongo. Fetches work fine. I have defined getters/setters and as well an alternative colletion name to be used (getSource()). However upon save() I get no errors but a blank document save for the _id being set.
Could someone point me to the path of enlightenment just in case I have this all wrong or could this be a bug?
TIA
namespace Apps\Document\Model;
use \Phalcon\Mvc\Collection;
class Client extends Collection
{
protected $client_id;
protected $client_secret;
public function getSource()
{
return "app_clients";
}
public function setClientId($client_id)
{
$this->client_id = $client_id;
}
public function getClient_Id()
{
return $this->client_id;
}
public function setClientSecret($client_secret)
{
$this->client_secret = $client_secret;
}
public function getClientSecret()
{
return $this->client_secret;
}
}
$AppDoc = new \Apps\Document\Model\Client();
$AppDoc->setClientId('some id');
$AppDoc->setClientSecret('shhhh');
$AppDoc->save();
This results in the following document
{
"_id" : ObjectId("539ab922279871b7238b4568")
}