Skip to content

This package contains code to help you copy ZohoCRM records directly into your database.

Notifications You must be signed in to change notification settings

extension-technologies/zoho-crm-copy-db

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Stable Version Latest Unstable Version License Scrutinizer Code Quality Build Status Coverage Status

Wabel's Zoho-CRM Database copier

What is this?

This project is a set of tools to help you copy your Zoho CRM records directly into your database. The tool will create new tables in your database matching Zoho records. If you are looking to synchronize data from ZohoCRM with your own tables, you should rather have a look at ZohoCRM Sync. It is built on top of the ZohoCRM ORM. Before reading further you should get used to working with ZohoCRM ORM, so if you do not know this library, STOP READING NOW and follow this link.

How does it work?

This projects provides a ZohoDatabaseCopier class, with a simple fetchFromZoho method. This method takes a ZohoDao in argument. ZohoDaos can be created using the ZohoCRM ORM. It also provides a ZohoDatabasePusher class with a pushToZoho method to push data to Zoho CRM.


ZohoDatabaseCopier for Module

Usage:

// $connection is a Doctrine DBAL connection to your database.
$databaseCopier = new ZohoDatabaseCopier($connection);

// $contactZohoDao is the Zoho Dao to the module you want to copy.
$databaseCopier->fetchFromZoho($contactZohoDao);

The copy command will create a 'zoho_Contacts' table in your database and copy all data from Zoho. Table names are prefixed by 'zoho_'.

You can change the prefix using the second (optional) argument of the constructor:

// Generated database table will be prefixed with "my_prefix_"
$databaseCopier = new ZohoDatabaseCopier($connection, "my_prefix_");

By default, copy is performed incrementally. If you have touched some of the data in your database and want to copy again everything, you can use the second parameter of the copy method:

// Pass false as second parameter to force copying everything rather than doing an incremental copy.
$databaseCopier->fetchFromZoho($contactZohoDao, false);

ZohoDatabaseCopier for Users

With the same $databaseCopier you can fetch the users from zoho. Usage:

// $connection is a Doctrine DBAL connection to your database.
$databaseCopier = new ZohoDatabaseCopier($connection);


```php
// $userResponse is the Zoho Client Response from zoho-crm-orm package.
$databaseCopier->fetchUserFromZoho($userResponse);

ZohoDatabasePusher

Usage:

// $connection is a Doctrine DBAL connection to your database.
$databaseSync = new ZohoDatabasePusher($connection);

// $contactZohoDao is the Zoho Dao to the module you want to push.
$databaseSync->pushToZoho($contactZohoDao);

Requirements

This project requires MySQL 5.7+ to work.

Symfony command

The project also comes with a Symfony Command that you can use to easily copy tables.

The command's constructor takes in parameter a ZohoDatabaseCopier instance, aZohoDatabasePusher instance and a ZohoClient. This command regenerates automatically the Daos in order to pass them in ZohoDatabaseCopier instance, aZohoDatabasePusher.

Usage:

# Command to synchronize data (both ways)
$ console zoho:sync
# Command to only fetch data from Zoho
$ console zoho:sync --fetch-only
# Command to only push data to Zoho
$ console zoho:sync --push-only

Listeners

For each ZohoDatabaseCopier, you can register one or many listeners. These listeners should implement the ZohoChangeListener interface.

You register those listener by passing an array of listeners to the 3rd parameter of the constructor:

$listener = new MyListener();
$databaseCopier = new ZohoDatabaseCopier($connection, "my_prefix_", [ $listener ]);

About

This package contains code to help you copy ZohoCRM records directly into your database.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%