We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7923
    • 4,213 Posts
    Hi,

    I have a query like this and it works fine:

    $principalMap = $modx->getObjectGraph(
      'ltPrincipalMap', 
      '{
        "PrincipalRoute":{
          "Polyline":{
            "PolylineMarker":{}
          }
        },
        "SchoolMarker":{}
      }', 
      array(
        'ltPrincipalMap.user_id' => $modx->user->get('id')
      )
    );
    


    I'd like to make it so that only the SchoolMarkers whose type is 3 is fetch to the result set, so I tried to add the condition to the criteria, but now it doesn't find anything.

    $principalMap = $modx->getObjectGraph(
      'ltPrincipalMap', 
      '{
        "PrincipalRoute":{
          "Polyline":{
            "PolylineMarker":{}
          }
        },
        "SchoolMarker":{}
      }', 
      array(
        'ltPrincipalMap.user_id' => $modx->user->get('id'),
        'SchoolMarker.type' => 3
      )
    );
    

    How it should be done?

    This question has been answered by doze. See the first response.



      "He can have a lollipop any time he wants to. That's what it means to be a programmer."
    • discuss.answer
      • 7923
      • 4,213 Posts
      Ahh... forget this.. That's the correct way to do it, I just had wrong field in the criteria, should have used PolylineMarker and not SchoolMarker, sorry.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."