[DDC-940] Entities can / can not have private properties Created: 15/Dec/10  Updated: 15/Dec/10

Status: Open
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: 2.0-RC2
Fix Version/s: None
Security Level: All

Type: Documentation Priority: Trivial
Reporter: Ray Rehbein Assignee: Roman S. Borschel
Resolution: Unresolved Votes: 0
Labels: None
Environment:

PHP 5.3.3 (cli) (built: Nov 14 2010 16:54:26)



 Description   

In the note in
http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html#merging-entities
It appears to state that private variables are not serialized for child objects

If this is the only reason entities can't have private properties, then this restriction is no longer valid, or possibly be reconsidered.

<?php

class A {
    private $a = null;

    public function setValue($value) {
        $this->a = $value;
    }
}

class B extends A {}

$b = new B();
$b->setValue("B");
var_dump($b);

$c = unserialize(serialize($b));
var_dump($c);

The output suggests private variables are serialized, and are restored fine


Generated at Sat Aug 02 02:41:06 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.