Skip to content
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.

Commit

Permalink
-Add describe function
Browse files Browse the repository at this point in the history
Added a describe function which runs a Vtiger API call to describe the elements(available fields) within a Vtiger module.
  • Loading branch information
cjcox17 authored Apr 24, 2018
1 parent 397c66d commit 3e8048b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Vtiger.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,31 @@ public function update($object)

return (isset($data->success)) ? $data : false;
}

public function describe($elementType)
{
$sessionid = self::sessionid();

if (isset($sessionid->success)) {
return $sessionid->message;
}

for ($i = 0; (!isset($data->success) && $i < 10); $i++) {
// send a request to describe a module (which returns a list of available fields) for a Vtiger module
$response = $this->client->request('GET', $this->url, [
'query' => [
'operation' => 'describe',
'sessionName' => $sessionid,
'elementType' => $elementType
]
]);

// decode the response
$data = json_decode($response->getBody()->getContents());
}

self::close($sessionid);

return (isset($data->success)) ? $data : false;
}
}

0 comments on commit 3e8048b

Please sign in to comment.