tristanjahier / zoho-crm-php

An API client for Zoho CRM, written in PHP.
MIT License
23 stars 12 forks source link

Example for insertRecords #4

Closed davidpeirs closed 6 years ago

davidpeirs commented 6 years ago

Dear,

great work , thanks but i keep getting issues with Attempted to call an undefined method named "insertRecord" of class "Zoho\CRM\Api\Modules\Leads".

could you please include an example for inserting.

Sincerly,

David.

ps : beer will be delivered next time i'm in Paris ;)

mharacewiat commented 6 years ago

Try to use insert() or insertMany() directly. It's defined in abstract AbstractRecordsModule.

tristanjahier commented 6 years ago

Hello @davidpeirs!

Can you please provide the code that produces this error?

I need to rewrite README.md completely but, as @Haru0 said, you must use the insert or insertMany methods. e.g.:

$zoho->leads->insert([
    'Property 1' => 'Value 1',
    'Property 2' => 'Value 2',
]);

or

$theLead = new Zoho\CRM\Entities\Lead([
    'Property 1' => 'Value 1',
    'Property 2' => 'Value 2',
]);

$zoho->leads->insert($theLead);
davidpeirs commented 6 years ago

it is solved ! Thank you so much for the quick response. @Haru0 & @tristanjahier Your module is great and the tip to fully check the Abstract was very helpfull. Thanks. David.

tristanjahier commented 6 years ago

Glad to hear that! 👍