Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1588

There is no way to get the Query's result cache impl without going to EM

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2-BETA2
    • Fix Version/s: 2.2
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      Ok, my problem is this:

      I have created a Query object. Now I'd like to get it's result cache driver.

      My options:
      1) Ask QueryCacheProfile for the driver. I can, but it's never populated by default so I always get just NULL.
      2) Ask Query with getResultCacheDriver(), but wait, I can't, that's now deprecated
      3) Ask from EM's configuration the result cache driver. This always works.

      I propose that either the QueryCacheProfile is always populated with the Query's default result cache impl unless specifically overridden for the QueryCacheProfile

      OR

      Make getResultCacheDriver() not deprecated. Like the other two related methods, they are not deprecated, why should this one. Calling this could populate the QueryCacheProfile for future use like all the other (get cache ttl, id) methods.

      My problem with with option 3) is "leaving the context of my method and the Query" (mentally of course). Why should I have to go poke around in EM's configuration when the result cache IS (or is easily obtainable behind the scenes) in the query object anyways?

        Activity

        Hide
        Benjamin Eberlei added a comment -

        Weird, this code looks very strange. I will check and fix that before the 2.2 RC release.

        Show
        Benjamin Eberlei added a comment - Weird, this code looks very strange. I will check and fix that before the 2.2 RC release.
        Hide
        Benjamin Eberlei added a comment -

        The default result cache is now passed to any new query cache profile. The following API is now working as expected:

        $query->useResultCache(true);
        $cache = $query->getQueryCacheProfile()->getResultCacheDriver();
        
        Show
        Benjamin Eberlei added a comment - The default result cache is now passed to any new query cache profile. The following API is now working as expected: $query->useResultCache( true ); $cache = $query->getQueryCacheProfile()->getResultCacheDriver();
        Hide
        Matti Niemelä added a comment -

        That's perfect! Thank you!

        Show
        Matti Niemelä added a comment - That's perfect! Thank you!

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Matti Niemelä
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: