0

I'm working on a plugin and need some steering. I have two sets of entries that are linked by a foreign key value. (They are not related entries but lsoaname value corresponds to a field in 2nd set of entries).

I want to loop through and join the matching values from set 1 with set 2. Thats the first part. But I also want to run this as a job from within the plugin and for each query match call a 3rd party API and save the API result to the set 1 entries. We are looking at only a couple of thousand records in the background process and one API call and entry save - so I assume that this is doable in terms of server resources etc

So my questions are:

  1. Can i include the job class in the plugin?

  2. Is there a standard way of writing the query in the plugin to do the join in the batch query style that a background job prefers? (Planning on using curl or guzzle for API cal)

     $entries = Entry::find()    
    ->section('openFunding')
    ->orderBy('lsoaname')
    ->limit(null)
    ->all();
    
    $OLFentries = Entry::find()    
    ->section('mapitOlfData')
    ->orderBy('title')
    ->limit(null)
    ->all();
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.