Пример #1
0
 public function setData($data)
 {
     //  var_dump($data);
     $this->contentClassName = $data->ContClassName;
     $this->numberStd = $data->NumberStd;
     $this->minOpt = $data->MinOpt;
     $this->maxOpt = $data->MaxOpt;
     if (!empty($data->PkgContentList->PkgContent)) {
         $packageContentList = array();
         foreach ($data->PkgContentList->PkgContent as $p) {
             $packageContent = new PackageContentData();
             $packageContent->setData($p);
             $packageContentList[] = $packageContent;
         }
         $this->packageContentList = $packageContentList;
     }
 }
Пример #2
0
 public function setData($data)
 {
     $this->setname($data->ServiceName);
     $this->setDescription($data->ServiceDesc);
     $this->setClassName($data->ServClassName);
     $this->setType($data->ServiceType);
     $this->setUnits($data->Units);
     $this->setRate($data->Rate);
     $this->setRateOverride($data->RateOverride);
     $this->setMinimumServiceDate($data->MinServiceDate);
     if (!empty($data->PackageList->PkgContClass)) {
         $packageList = array();
         foreach ($data->PackageList->PkgContClass as $p) {
             $package = new PackageData();
             $package->setData($p);
             $packageList[] = $package;
         }
         $this->packageList = $packageList;
     } else {
         if (!empty($data->PkgContentList->PkgContent)) {
             /*
              * This handles the fact that subscriber packages dont come listed
              * in their classes.
              */
             // First we organize the content into package classes
             $t_packages_by_class = array();
             foreach ($data->PkgContentList->PkgContent as $pc) {
                 $packageContent = new PackageContentData();
                 $packageContent->setData($pc);
                 $packageContent->setProvisioned(true);
                 $t_packages_by_class[$pc->ContClassName][] = $packageContent;
                 unset($packageContent);
             }
             // Now we can add the packages properly
             $packageList = array();
             foreach ($t_packages_by_class as $class => $content) {
                 $package = new PackageData();
                 $package->setContentClassName($class);
                 $package->setPackageContentList($content);
                 $packageList[] = $package;
             }
             $this->packageList = $packageList;
         }
     }
 }