示例#1
0
 /**
  * @return bool
  */
 protected function _nextRowset()
 {
     unset($this->_rowset);
     // Skip some fields under certain circumstances
     $skipParams = array();
     if ($this->_type == self::TYPE_STREAM) {
         $skipParams = $this->_params;
         unset($skipParams['readDirection']);
     }
     // Make request for the new rowset
     try {
         $params = $this->_getNextParamValues(array_keys($skipParams));
         $this->_rowset = $this->_apiObject->read($params);
     } catch (Exception $e) {
         if ($this->_type == self::TYPE_STREAM) {
             // Reset readDirection
             $this->_nextParamValues['readDirection'] = Bronto_Api_Object::DIRECTION_FIRST;
             // Get params again without skipping
             $params = $this->_getNextParamValues();
             $this->_rowset = $this->_apiObject->read($params);
         } else {
             throw $e;
         }
     }
     if (!$this->_rowset) {
         throw new Bronto_Api_Rowset_Exception('Retrieving the next Rowset failed');
     }
     // Increments
     $this->_newPage = true;
     $this->_page = $this->_page + 1;
     $this->_count = $this->_count + $this->_rowset->count();
     // Re-setup params
     $this->_setupParamValues();
     return $this->_rowset->valid();
 }
 /**
  * @param array $filter
  * @param int $pageNumber
  * @return Bronto_Api_Rowset
  */
 public function readAll(array $filter = array(), $pageNumber = 1)
 {
     $params = array();
     $params['filter'] = $filter;
     $params['pageNumber'] = (int) $pageNumber;
     return parent::read($params);
 }
 /**
  * @param array $filter
  * @param int $pageNumber
  * @return Bronto_Api_Rowset
  */
 public function readAll(array $filter = array(), $pageNumber = 1)
 {
     $params = array('filter' => array(), 'pageNumber' => (int) $pageNumber);
     if (!empty($filter)) {
         if (is_array($filter)) {
             $params['filter'] = $filter;
         } else {
             $params['filter'] = array($filter);
         }
     } else {
         $params['filter'] = array('contactId' => array());
     }
     return parent::read($params);
 }
示例#4
0
 /**
  * @param array $filter
  * @param array $fields
  * @param bool $includeLists
  * @param int $pageNumber
  * @return Bronto_Api_Rowset
  */
 public function readAll($filter = array(), $fields = array(), $includeLists = true, $pageNumber = 1)
 {
     $params = array('filter' => array(), 'fields' => array(), 'includeLists' => (bool) $includeLists, 'pageNumber' => (int) $pageNumber);
     if (!empty($filter)) {
         if (is_array($filter)) {
             $params['filter'] = $filter;
         } else {
             $params['filter'] = array($filter);
         }
     }
     if (!empty($fields)) {
         if (is_array($fields)) {
             $params['fields'] = $fields;
         } else {
             $params['fields'] = array($fields);
         }
     }
     return parent::read($params);
 }
示例#5
0
 /**
  * @param string $startDate
  * @param int $size
  * @param string|array $types
  * @param string $direction
  * @param string|array $contactIds
  * @return Bronto_Api_Rowset
  */
 public function readAll($startDate = '2002-01-01T00:00:00+00:00', $size = 1000, $types = array(), $direction = self::DIRECTION_FIRST, $contactIds = array())
 {
     $filter = array('start' => '2002-01-01T00:00:00+00:00', 'size' => 1000, 'types' => $this->getOptionValues('trackingType'), 'readDirection' => self::DIRECTION_FIRST, 'contactIds' => array());
     if (!empty($startDate)) {
         $filter['start'] = $startDate;
     }
     if (!empty($size)) {
         $filter['size'] = $size < 1000 ? 1000 : (int) $size;
     }
     if (!empty($types)) {
         if (is_array($types)) {
             $filter['types'] = $types;
         } else {
             $filter['types'] = array($types);
         }
     }
     $direction = strtoupper($direction);
     if (in_array($direction, $this->_options['readDirection'])) {
         $filter['readDirection'] = $direction;
     }
     if (!empty($contactIds)) {
         if (is_array($contactIds)) {
             $filter['contactIds'] = $contactIds;
         } else {
             $filter['contactIds'] = array($contactIds);
         }
     }
     // @todo Remove if the contactIds filter is enabled again
     unset($filter['contactIds']);
     return parent::read(array('filter' => $filter));
 }