Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2130

A problem with obtaining Entity without cache

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      Symfony 2.0.18

      Description

      I use a custom validation constraint.
      In the constraint I want to compare old and new entity, but when I take a entity from database, I got a entity witch is equvivalent the new entity.

      I tried to use a query without cache

      $query = $this->getDoctrine()->getRepository('SSWTestBundle:SimpleEntity')->createNamedQuery(...);
      ...
      $query->useResultCache(FALSE);
      

      This don't solved my problem.

      I tried to use a query without cache and with refresh

      $query = $this->getDoctrine()->getRepository('SSWTestBundle:SimpleEntity')->createNamedQuery(...);
      ...
      $query->useResultCache(FALSE);
      $query->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true);
      

      This time I got a old entity from database, but the new entity was rollback to the old entity.

      In attach is my entity and TestCase.

      1. SimpleEntity.php
        1 kB
        SergSW
      2. SimpleEntityTest.php
        5 kB
        SergSW

        Activity

        SergSW created issue -
        SergSW made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            SergSW
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: