Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2862

When update cached entitiy, entity lost OneToOne relationship

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.5
    • Component/s: ORM
    • Security Level: All

      Description

      Second-level-cache

      $driver = $em->find('CachedDoctrine\Entities\Driver', 1); //Get cached entity
      dump($driver->getUserProfile()); //Return User
      $driver->setName('Franta');
      $em->flush();
      $em->clear();

      $driver = $em->find('CachedDoctrine\Entities\Driver', 1);
      dump($driver->getUserProfile() ); //Return null

      1. Driver.php
        0.9 kB
        Lukáš Bauer
      2. User.php
        0.5 kB
        Lukáš Bauer

        Activity

        Hide
        Benjamin Eberlei added a comment -

        assigned to Fabio

        Show
        Benjamin Eberlei added a comment - assigned to Fabio
        Hide
        Fabio B. Silva added a comment -

        Can you please attached your entities ?

        Show
        Fabio B. Silva added a comment - Can you please attached your entities ?
        Show
        Lukáš Bauer added a comment - I attach the files. Is it from project: https://github.com/CoolLamer/CachedDoctrine files is from: https://github.com/CoolLamer/CachedDoctrine/blob/master/app/model/Entities/Driver.php https://github.com/CoolLamer/CachedDoctrine/blob/master/app/model/Entities/User.php
        Hide
        Lukáš Bauer added a comment -

        The entity is not stored in the cache until the parameter of its subordinate entities is loaded. Entities are same.

        Example:
        $driver = $em->find('CachedDoctrine\Entities\Driver', 1); //load from db
        $em->clear();

        $driver = $em->find('CachedDoctrine\Entities\Driver', 1); //again load from db
        $driver->getUserProfile()->getName() //Access parametr
        $em->clear();

        $driver = $em->find('CachedDoctrine\Entities\Driver', 1); //now load from cache

        Show
        Lukáš Bauer added a comment - The entity is not stored in the cache until the parameter of its subordinate entities is loaded. Entities are same. Example: $driver = $em->find('CachedDoctrine\Entities\Driver', 1); //load from db $em->clear(); $driver = $em->find('CachedDoctrine\Entities\Driver', 1); //again load from db $driver->getUserProfile()->getName() //Access parametr $em->clear(); $driver = $em->find('CachedDoctrine\Entities\Driver', 1); //now load from cache
        Show
        Fabio B. Silva added a comment - Fixed by : https://github.com/doctrine/doctrine2/commit/960fbfc110b5d62a245eb6686f788e04c5019c2e

          People

          • Assignee:
            Fabio B. Silva
            Reporter:
            Lukáš Bauer
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: