public static function createZonePlan($data, $zoneNames = array(), &$relation = array()) { $zonePlan = new ZonePlanModel(); $zonePlan->name = "Zone plan from version 1.1"; $i = 1; foreach ($data as $zoneGroupId => $zones) { $zoneGroup = new ZoneGroupModel(); $zoneGroup->id = $i; $zoneGroup->name = isset($zoneNames[$zoneGroupId]) ? $zoneNames[$zoneGroupId] : "Zone " . $zoneGroupId; $zoneGroup->zones = $zones; $relation[$zoneGroupId] = $i; $i++; $zonePlan->addZoneGroup($zoneGroup); } return $zonePlan; }
protected function _insertEricsson(ZonePlanModel $object) { $methodName = self::METHOD_NAME_CREATE; try { $proto = $this->_createProto($methodName); $createData = new ZonePlan(); $proto->setCreateData($createData); $mappedData = $this->_mapModelToEricssonModel($object->exportData()); $parser = new \DrSlump\Protobuf\Codec\PhpArray(array('strict' => true)); $createData->parse($mappedData, $parser); $response = $this->_sendRequest($methodName, array('protoMessage' => $proto)); } catch (Exception $e) { \App::log()->CRIT($e); } $this->_checkPostResponse($response); $object->setId($response->getId()); return $object->getId(); }