We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31410
    • 66 Posts
    hi iam using xpdo in a project
    the getcollection(’table’,$query) is not working and its not fetching other tables data when using with join
    my code is
    $rq=$b2b->newQuery(’Rfp’);
    $rq->leftJoin(’UserProfile’,’Reseller’,’`Rfp`.`reseller` = `Reseller`.`internalKey`’);
    $rq->leftJoin(’CompanyJobtype’,’Job’,’`Rfp`.`jobType` = `Job`.`jobId`’);
    $rq->select(array(’Rfp.*’,’Reseller.firstName’,’Reseller.lastName’,’Reseller.mobile’,’job.jobType’));
    $rfps=$b2b->getCollection(’Rfp’,$rq);
    foreach($rfps as $rfp){
    $a=$rfp->toArray();
    print_r($a);
    }

    i tried with toQuery(); and the sql returning with toquery is perfect
    but in the getcollection result other tables data in not fetched
    more importantly the join conditions also not counting when getcollection is fetched

    just to clarify i have extended xpdo to b2b
    not sure what i missed
      • 31410
      • 66 Posts
      by looking at one topic http://modxcms.com/forums/index.php/topic,37872.0.html
      i understood XPDO_OPT_HYDRATE_ADHOC_FIELDS should be set to true
      but it was const OPT_HYDRATE_ADHOC_FIELDS = ’hydrate_adhoc_fields’;
      what value i have to give now to make getcollection work here?
        • 22303 MODX Staff
        • 10,725 Posts
        getCollection will not return objects represented by tables you have manually joined. This is what getCollectionGraph() is for.