Issue on syncing Google Contacts via cron

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stefkev
    Junior Member
    • Sep 2019
    • 1

    Issue on syncing Google Contacts via cron

    Hi,

    I am having issue on creating a cron job on google contact upload.

    I use following function to dispatch a task


    PHP Code:
    $collection = $this->getEntityManager()->getRepository('Contact')->where(array('deleted' => false))->find();
    try {    
    $gc = new GoogleContacts($this->getContainer());
       foreach($collection as $contactData) {
            array_push($data->idList, $contactData->id);
            $gc->actionPush(null, $data, null);
        }
     }catch (\Exception $e) {
        $GLOBALS['log']->error('GoogleContactSync: Run Sync Error: ' . $e);
    } 
    
    Keep in mind that in data, entityType is set to Contact, and idList is set of contact id's fetched from database.
    I get issue following issue on executing the task:

    Error Details: Call to a member function getContactsClient() on null. All linking to google contact is set properly, and when i do manual push of data it works.
    Last edited by stefkev; 09-18-2019, 03:25 PM.
Working...