Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-940

Entities can / can not have private properties

    Details

    • Type: Documentation Documentation
    • Status: Open
    • Priority: Trivial Trivial
    • Resolution: Unresolved
    • Affects Version/s: 2.0-RC2
    • Fix Version/s: None
    • Component/s: Documentation
    • Security Level: All
    • 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

        Activity

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Ray Rehbein
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: