1 | <?php |
||
15 | abstract class AbstractZohoDao |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * The class implementing API methods not directly related to a specific module. |
||
20 | * |
||
21 | * @var ZohoClient |
||
22 | */ |
||
23 | protected $zohoClient; |
||
24 | |||
25 | |||
26 | /** |
||
27 | * Array that contains fields that can't be managed |
||
28 | * with the ORM and are manually added with the |
||
29 | * addUnmanagedField method |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $unmanagedFields = []; |
||
33 | |||
34 | public function __construct(ZohoClient $zohoClient) |
||
38 | |||
39 | abstract protected function getModule(); |
||
44 | |||
45 | /** |
||
46 | * @return ZohoClient |
||
47 | */ |
||
48 | public function getZohoClient(): ZohoClient |
||
52 | |||
53 | |||
54 | /** |
||
55 | * @return Field[] |
||
56 | */ |
||
57 | public function getFields() |
||
65 | |||
66 | |||
67 | /** |
||
68 | * Returns a module from Zoho. |
||
69 | * |
||
70 | * @return \ZCRMModule |
||
71 | */ |
||
72 | public function getZCRMModule() |
||
76 | |||
77 | /** |
||
78 | * Parse a Zoho Response in order to retrieve one or several ZohoBeans from it. |
||
79 | * |
||
80 | * @param \ZCRMRecord[] $ZCRMRecords |
||
81 | * @return ZohoBeanInterface[] The array of Zoho Beans parsed from the response |
||
82 | * @throws ZohoCRMORMException |
||
83 | */ |
||
84 | protected function getBeansFromZCRMRecords(array $ZCRMRecords) |
||
101 | |||
102 | /** |
||
103 | * Implements deleteRecords API method. |
||
104 | * |
||
105 | * @param string $id |
||
106 | * @return ZohoBeanInterface[] |
||
107 | * @throws ZohoCRMORMException |
||
108 | */ |
||
109 | public function delete($id): array |
||
124 | |||
125 | /** |
||
126 | * Implements getRecordById API method. |
||
127 | * |
||
128 | * @param string $id Zoho Id of the record to retrieve OR an array of IDs |
||
129 | * |
||
130 | * @return ZohoBeanInterface The array of Zoho Beans parsed from the response |
||
131 | * @throws ZohoCRMORMException |
||
132 | */ |
||
133 | public function getById($id): ZohoBeanInterface |
||
141 | |||
142 | /** |
||
143 | * Implements getRecords API method. |
||
144 | * |
||
145 | * @param string|null $cvId |
||
146 | * @param string|null $sortColumnString |
||
147 | * @param string|null $sortOrderString |
||
148 | * @param \DateTime|null $lastModifiedTime |
||
149 | * @param int $page |
||
150 | * @param int $perPage |
||
151 | * @return ZohoBeanInterface[] |
||
152 | * @throws ZohoCRMORMException |
||
153 | * @throws \ZCRMException |
||
154 | */ |
||
155 | public function getRecords($cvId = null, $sortColumnString = null, $sortOrderString = null, \DateTime $lastModifiedTime = null, $page = 1, $perPage = 200): array |
||
170 | |||
171 | /** |
||
172 | * Returns the list of deleted records. |
||
173 | * |
||
174 | * @param \DateTimeInterface|null $lastModifiedTime |
||
175 | * @param int $page |
||
176 | * @param int $perPage |
||
177 | * @return \ZCRMTrashRecord[] |
||
178 | * @throws \ZCRMException |
||
179 | */ |
||
180 | public function getDeletedRecordIds(\DateTimeInterface $lastModifiedTime = null, $page = 1, $perPage = 200) |
||
184 | |||
185 | /** |
||
186 | * @Todo |
||
187 | */ |
||
188 | // public function getRelatedRecords |
||
189 | // public function searchRecords |
||
190 | // public function uploadFile |
||
191 | // public function downloadFile |
||
192 | |||
193 | /** |
||
194 | * Implements insertRecords or updateRecords or upsertRecords API method. |
||
195 | * |
||
196 | * @param ZohoBeanInterface[] $beans |
||
197 | * @param bool $wfTrigger Whether or not the call should trigger the workflows related to a "created" event |
||
198 | * @throws ZohoCRMORMException |
||
199 | */ |
||
200 | public function createOrUpdate( array $beans, bool $wfTrigger = false, $action = 'upsert'): void |
||
244 | |||
245 | /** |
||
246 | * Implements insertRecords API method. |
||
247 | * |
||
248 | * @param ZohoBeanInterface[] $beans |
||
249 | * @param bool $wfTrigger Whether or not the call should trigger the workflows related to a "created" event |
||
250 | * @throws ZohoCRMORMException |
||
251 | */ |
||
252 | public function insertRecords( array $beans, bool $wfTrigger = false): void |
||
256 | |||
257 | /** |
||
258 | * Implements updateRecords API method. |
||
259 | * |
||
260 | * @param ZohoBeanInterface[] $beans |
||
261 | * @param bool $wfTrigger |
||
262 | * @throws ZohoCRMORMException |
||
263 | */ |
||
264 | public function updateRecords(array $beans, bool $wfTrigger = false): void |
||
268 | |||
269 | /** |
||
270 | * Saves the bean or array of beans passed in Zoho. |
||
271 | * It will perform an insert if the bean has no ZohoID or an update if the bean has a ZohoID. |
||
272 | * wfTrigger only usable for a single record update/insert. |
||
273 | * |
||
274 | * @param ZohoBeanInterface|ZohoBeanInterface[] $beans A bean or an array of beans. |
||
275 | * @param bool $wfTrigger |
||
276 | */ |
||
277 | public function save($beans, $wfTrigger = false): void |
||
302 | |||
303 | /** |
||
304 | * @return ZohoBeanInterface |
||
305 | * @throws ZohoCRMORMException |
||
306 | */ |
||
307 | public function create() |
||
315 | |||
316 | /** |
||
317 | * @param $fieldName |
||
318 | * @return null|Field |
||
319 | */ |
||
320 | public function getFieldFromFieldName($fieldName) |
||
336 | |||
337 | |||
338 | /** |
||
339 | * Add a field that can't be managed with the ORM |
||
340 | * |
||
341 | * @param $fieldApiName |
||
342 | * @param $value |
||
343 | */ |
||
344 | public function addUnmanagedField($fieldApiName, $value) { |
||
347 | |||
348 | /** |
||
349 | * @return array |
||
350 | */ |
||
351 | public function getUnamanagedFields() { |
||
354 | } |
||
355 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: