/** * Create a new Batch with the given data and associate with the given job * * @param JobInfo $job * @param $data * @return BatchInfo */ public function createBatch(JobInfo $job, $data) { if ($job->getContentType() == self::CSV) { $contentType = self::CONTENT_TYPE_CSV; } else { if ($job->getContentType() == self::XML) { $contentType = self::CONTENT_TYPE_XML; } else { if ($job->getContentType() == self::ZIP_CSV) { $contentType = self::CONTENT_TYPE_ZIP_CSV; } else { if ($job->getContentType() == self::ZIP_XML) { $contentType = self::CONTENT_TYPE_ZIP_XML; } else { throw new Exception("Invalid content type specified for batch"); } } } } return new BatchInfo($this->post($this->url(array(self::JOB, $job->getId(), self::BATCH)), $contentType, $data)); }