We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19980 ☆ A M B ☆
    • 275 Posts
    Hey
    thanks for your time

    >>> The fact that you don't get a success or failure message suggest that something is going wrong inside the addPackage() function. Anything in the MODX error log (Reports -> Error Log).?

    it's empty after this code ran:

    <?php
    $path = MODX_CORE_PATH . 'components/certsfunction/'; 
    $result = $modx->addPackage('certsfunction',$path . 'model/','import_');
    if (! $result) { 
      return 'failed to add package';
    } else {
      $output1 = '<p>added Package</p>';
    }
    
    $CERT = $modx->getCollection('Certs'); 
    //$CERT = $modx->getCollection('certs',array('LENDERNAME'=>'Atlantic Bank'));
    
    $output1 .= '<p>Total: '. count($CERT) . '</p>';
    
    /*foreach($CERT as $quote) {
    
        $output .= '<p>LENDERNAME: ' . $quote->get('LENDERNAME');
        $output .= '
    LOAN_ID: ' . $quote->get('LOAN_ID'). '</p>';
    }*/
    
    return $output1;
    




    >>> don't think the capital C should be a problem.
    ok


    >> I wonder if you need to call your class modCerts
    no no, I do not call it I only listed it's code for the forum. The complete/all lines of the executed code is above.

    Digging more.. [ed. note: modx.customize last edited this post 14 years, 9 months ago.]
      modx and ecommerce pro
      • 19980 ☆ A M B ☆
      • 275 Posts
      Forgot to mention: CERTS table has 38k records.
      And now when I limit the getCollection as

      $CERT = $modx->getCollection('Certs',array('idName'=>'Atl0nticos'));


      I get some results that can be for this limit. But I definitely was hoping I can get all results and operate with them at least with
      ini_set('set_time_limit', 0); 
      but failed.

      I am very curious why 38k is a problem for getCollection probably I should use diff method?
        modx and ecommerce pro
        • 22303 MODX Staff
        • 10,725 Posts
        Use getIterator(). getCollection() would load the entire db result set AND all 38,000 objects into memory at once. getIterator() only loads one row and object at a time as you iterate through the result set.