I'm using Doctrine 2 ODM (with MongoDB).
My Document model:
class Users_Model_User
{
public $id;
public $username;
public $password;
public $myRuntimeProperty = 'some value';
}
My Document mapping in YAML:
Users_Model_User:
db: my_db
collection: users
fields:
id:
fieldName: id
id: true
username:
fieldName: username
type: string
password:
fieldName: password
type: string
My test code:
$user = new Users_Model_User;
$user->username = 'hello';
$user->password = 'world';
$this->dm->persist($user);
$this->dm->flush();
$user = $this->dm->findOne('Users_Model_User', array('username' => 'hello'));
Zend_Debug::dump($user);
My result:
object(Users_Model_User)#81 (4) {
["id"] => string(24) "4c1d5eb68ead0eb332000000"
["username"] => string(5) "hello"
["password"] => string(5) "world"
["myRuntimeProperty"] => string(10) "some value"
}
How do I make it so that "myRuntimeProperty" does not get saved with my document? My models are being saved with all properties including things like "_propertyChangedListeners" which is messing everything up when the model gets reloaded.