public function jsonUpdateDataProvider()
 {
     return array(array('Grow\\Client\\Model\\Baby', array("Centile" => 22.33), Baby::createNew()->setCentile(22.33)));
 }
use Grow\Client\Model\Baby;
use Grow\Client\Model\Chart;
use Grow\Client\Model\Centile;
use Grow\Client\Model\Measurement;
use Grow\Client\Model\Config\ImageConfig;
use Grow\Client\Model\Config\PdfConfig;
use Grow\Client\Model\Option\GenderOption;
use Grow\Client\Model\Option\EthnicityOption;
$apiClient = ApiClientFactory::getInstance()->getClient(GROW_API_USERNAME, GROW_API_PASSWORD);
$edd = new DateTime("-1 day");
$ethnicities = $apiClient->getEthnicities();
$genders = $apiClient->getGenders();
$outcomes = $apiClient->getOutcomes();
$measurementTypes = $apiClient->getMeasurementTypes();
$hospitals = $apiClient->getHospitals();
$babies = array(Baby::createNew()->setBirthOrderNumber(0)->setBirthWeight(3550)->setGender($genders->current()->getIdentifier())->setGestation(275)->setName('Baby1')->setUnknown(false), Baby::createNew()->setBirthOrderNumber(1)->setUnknown(true));
$imageConfig = ImageConfig::createNew()->setGreyscale(false)->setGridlinesByWeight(false)->setScalePercent(200)->setShowExtraCentiles(false);
$pdfConfig = PdfConfig::createNew()->setGreyscale(false)->setGridlinesByWeight(false)->setShowExtraCentiles(false);
$chart = Chart::createNew()->setBabies($babies)->setDob(new DateTime("1990-01-01 01:01:01"))->setEdd($edd)->setEthnicity($ethnicities->current()->getIdentifier())->setFirstname("SampleFN")->setLastname("SampleLN")->setMotherRef("SampleMR")->setGetPdf(true)->setGetImage(true)->setHeight(163)->setImageConfig($imageConfig)->setPdfConfig($pdfConfig)->setWeight(45);
$chartResponse = $apiClient->addChart($chart);
$chartIdentifier = $chart->getChartIdentifier();
$chartIdentifierPrefix = $apiClient->getChartIdentifierPrefix($chartIdentifier);
$prefixedChartIdentifier = sprintf("%s%s", (string) $chartIdentifierPrefix, $chartIdentifier);
echo sprintf("Chart #%s added.\n", $chartIdentifier);
$imageFilename = sprintf("/tmp/%s.jpg", $chartIdentifier);
$chartResponse->saveImage($imageFilename);
echo sprintf("Chart's image saved as '%s'.\n", $imageFilename);
$pdfFilename = sprintf("/tmp/%s.pdf", $chartIdentifier);
$chartResponse->savePdf($pdfFilename);
echo sprintf("Chart's pdf saved as '%s'.\n", $pdfFilename);
// getChart($chartIdentifier, DateTime $edd, ImageConfig $imageConfig);
 public function jsonUpdateDataProvider()
 {
     return array(array('Grow\\Client\\Model\\Chart', array("ChartIdentifier" => 1018, "ChartImage" => base64_encode('image'), "ChartPDF" => base64_encode('pdf'), "BMI" => 16.9, "TOW" => 3423, 'Babies' => array(array('BirthOrderNumber' => 0, 'Centile' => 22.33), array('BirthOrderNumber' => 1, 'Centile' => 22.34))), Chart::createNew()->setChartIdentifier(1018)->setChartImage(base64_encode('image'))->setChartPdf(base64_encode('pdf'))->setBmi(16.9)->setTow(3423)->setBabies(array(Baby::createNew()->setBirthOrderNumber(0)->setCentile(22.33), Baby::createNew()->setBirthOrderNumber(1)->setCentile(22.34)))));
 }
 /**
  * @param  integer $birthOrderNumber
  * @return Baby
  */
 public function getBaby($birthOrderNumber)
 {
     foreach ($this->getBabies() as $baby) {
         if ($baby->getBirthOrderNumber($birthOrderNumber)) {
             return $baby;
         }
     }
     $baby = Baby::createNew()->setBirthOrderNumber($birthOrderNumber);
     $this->addBaby($baby);
     return $baby;
 }