We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33968
    • 863 Posts
    I'm just wondering what is the difference between these two executions:
    $query = $xpdo->newQuery('Box');
    $query->select(array('id','name'));
    $boxes = $xpdo->getCollection('Box',$query);
    

    $query = $xpdo->newQuery('Box');
    $query->select($xpdo->getSelectColumns('Box','Box','',array('id','name')));
    $boxes = $xpdo->getCollection('Box',$query);
    

    Both work. Is there a good reason for using getSelectColumns?
      • 22303 MODX Staff
      • 10,725 Posts
      Escaping of column names in a db-agnostic manner is the advantage. Also, being able to set table aliases and column prefixes which are also auto-escaped provides for flexibility when using joins, graphs, and other complex queries.
        • 33968
        • 863 Posts
        Gotcha. Thanks for the quick reply!