Git Product home page Git Product logo

zoho-crm-orm's Introduction

Scrutinizer Code Quality Build Status Coverage Status

Wabel's Zoho-CRM ORM

Heavily forked from mctekk's work

What is this?

This project is a PHP connector to Zoho CRM. Use this connector to access ZohoCRM data from your PHP application.

Who is it different from other connectors?

Unlike other Zoho CRM clients, the Zoho-CRM ORM uses a code generator to generate Beans and DAOs to easily access Zoho objects from PHP.

Beans and DAOs?

A small bit of code is better than a long phrase, here you go with a sample:

use \Wabel\Zoho\CRM\ZohoClient;

// The ZohoClient class is the low level class used to access Zoho.
$zohoClient = new ZohoClient($zohoAuthToken);

// Use the "DAO" class to write to some module of Zoho.
// Each module (even custom ones) has its own class.
$contactZohoDao = new ContactZohoDao($zohoClient);

// For each DAO, there is a bean associated.
$contact = new Contact();
$contact->setLastName("Doe");
$contact->setFirstName("John");

// Use the "save" method to save the bean.
$contactDao->save($contact);

// Use the "searchRecords" method to fetch data from Zoho.
$records = $contactDao->searchRecords("(Last Name:FooBar)");
foreach ($records as $record) {
    // Each record is a "Contact" object.
    echo $record->getLastName();
}

What you must always remember:

  • Beans are used to map records in Zoho. There is one class per Zoho module
  • DAOs are used to send beans to Zoho. There is one DAO per Zoho module

But how do I generate Beans and DAOs?

There are several techniques.

Using pure PHP code:

use \Wabel\Zoho\CRM\ZohoClient;

// The ZohoClient class is the low level class used to access Zoho.
$zohoClient = new ZohoClient($zohoAuthToken);

// The EntitiesGeneratorService class is in charge of generating Beans and DAOs.
$entitiesGenerator = new EntitiesGeneratorService($client);

// The target directory we will write into.
$directory = __DIR__.'/src/TestNamespace/';
// The namespace for the beans and DAOs.
$namespace = 'TestNamespace';

$generator->generateAll($directory, $namespace);

Setting up unit tests

Interested in contributing? You can easily set up the unit tests environment:

  • copy the phpunit.xml.dist file into phpunit.xml
  • change the stored auth_token
  • run the tests: vendor/bin/phpunit

Troubleshooting

  • I'm saving a bean (using the save method of the DAO) and searching for it afterwards (using searchRecords). The bean is not returned.
    This is a Zoho issue. Zoho takes about one minute to index the records you insert. So you must wait about one minute before the Zoho bean you saved will be findable using the searchRecords method.

zoho-crm-orm's People

Contributors

moufmouf avatar wizmik avatar stmaxvl avatar

Watchers

James Cloos avatar Dmytro Momot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.