/** * Converts this iterator into an instance of Morph_Collection * * Note that this means all objects will be held in memory so * you need to be a bit careful not to exceed memory limits * * @return Morph_Collection */ public function toCollection() { $collection = new Collection(); $collection->setPermissableType(\get_class($this->type)); $collection->setTotalCount($this->totalCount()); $this->rewind(); foreach ($this as $object) { $collection->append($object); } return $collection; }
/** * Retrieve an array with available records for a specific form. * * @param string $strFormId The Fulcrum form id * @return \Fulcrum\Records */ public function getRecords($strFormId, $arrParameters = array()) { $objReturn = new Collection(); $strGet = "/records"; $arrParameters["form_id"] = $strFormId; $this->objRest = new RestRequest($this->apiUrl . $strGet, "GET", $arrParameters, $this->getHeaders()); $this->objRest->execute(); $this->parseResponse(); if (is_object($this->response)) { $objReturn->setTotalCount($this->response->total_count); $objStdRecords = $this->response->records; $objForm = $this->getForm($strFormId); foreach ($objStdRecords as $objStdClass) { $objReturn->addObject(new Record($objStdClass, $objForm)); } } return $objReturn; }