Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      Consider two classes User and Address with one-to-many association.
      I would like to preload addresses for given user object so that it will be accessible via getter method like this:

      1. $user = $userRepository->find($userId);
      2. load some of the addresses but not all
      3. $user->getAddresses() should return those loaded in step 2

      Currently the only solution for step 2 I found working is to write a DQL like this:
      SELECT u, a
      FROM User
      INNER JOIN u.addresses a
      WHERE u = :user AND a.foo = 1

      When the data is hydrated it is assigned to the user object and thus accessible with $user->getAddresses (which normally would return all the addresess not only those with foo set)

      The only problem is that the query in step 2 unnecessarily fetches all user data that was already fetched in step 1

        Activity

        There are no comments yet on this issue.

          People

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

            Dates

            • Created:
              Updated: