/** * Implements Base\BaseObject::__toString(). * * @return string */ public function __toString() { $endDate = $startDate = ''; $endDateTime = $this->getEndDateTime(); $startDateTime = $this->getStartDateTime(); if ($endDateTime instanceof DateTime) { $endDate = $endDateTime->format('Y-m-d H:i:s'); } if ($startDateTime instanceof DateTime) { $startDate = $startDateTime->format('Y-m-d H:i:s'); } $obj = array('developer' => array('id' => $this->developer_or_company_id), 'endDate' => $endDate, 'startDate' => $startDate, 'id' => $this->id, 'ratePlan' => null); if (isset($this->ratePlan)) { $obj['ratePlan'] = array('id' => $this->ratePlan->getId()); } return json_encode($obj); }