We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22427
    • 793 Posts
    Seems I have a lot to learn about xPDO...

    Now I tried
    $packageName = 'myPackage';
    $prefix = null;
    $packagepath = $modx->getOption('core_path') . 'components/' . $packageName . '/';
    $modelpath = $packagepath . 'model/';
    if (is_dir($modelpath)) {
        $modx->addPackage($packageName, $modelpath, $prefix);
    };
    
    $myArr = array(11,22,33);
    $classname = 'myXpdoClass';
    $c = $modx->newQuery($classname);
    $c->where(array("id:IN" => $myArr));
    $c->prepare();
    print $c->toSQL();
    and the table name is found - fine so far!

    But when I continue with
    if ($collection = $modx->getCollection('$classname',$c)){
        print('BLISS');
    } else {
        print('FAIL');
    };
    I get FAIL.
    [ed. note: ottogal last edited this post 9 years, 2 months ago.]
      • 4172
      • 5,888 Posts
      try

      if ($collection = $modx->getCollection($classname,$c)){
          print('BLISS');
      } else {
          print('FAIL');
      };
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 22427
        • 793 Posts
        BLISS!
        What a trivial mistake.
        So now I try the UPDATE thing...
          • 22427
          • 793 Posts
          And it works!
          So many thanks for your patient help, Bruno and Bob!