[MODM-9] Unexpected: MappedSuperclass private property without annotation becomes persisted Created: 03/Jun/10  Updated: 09/Jun/10  Resolved: 03/Jun/10

Status: Resolved
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0ALPHA1
Fix Version/s: 1.0.0ALPHA1

Type: Bug Priority: Minor
Reporter: Florian Kubis Assignee: Jonathan H. Wage
Resolution: Fixed Votes: 0
Labels: None

OS X, latest ODM checkout

/** @MappedSuperclass */
class Model {

    private $errors = array();

    protected function getErrors() {
        return $this->errors;

 * @Document(db="mydb", collection="data")
class Data extends Model {
     * @Id
    public $id;

     * @String
    public $name;

Did not expect, that $errors goes into mongo.

Comment by Jonathan H. Wage [ 03/Jun/10 ]

This is expected behavior. It was changed so that all properties are persisted unless specified otherwise. Map the property is @Transient and it will be ignored by Doctrine:

class MyDocument
    // ...

    /** @Transient */
    private $errors = array();
Comment by Florian Kubis [ 04/Jun/10 ]

Thanks, this works.
Just to complete this issue, for now documentation of @Transient is missing in the reference.

Comment by Jonathan H. Wage [ 04/Jun/10 ]

Thanks. I have updated the documentation with the new @Transient annotation.

Generated at Mon Aug 31 09:37:29 EDT 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.