Beispiel #1
0
 /**
  * Creates a Tenant on the server with the given parameters.
  * @param string $url The URL of the Tenant to create.
  * @param string $description A short description of the Tenant being created.
  * @param TenantStatus $status The status of the Tenant.
  * @param TenantType $type The TenantType associated with the Tenant.
  * @param PaymentPlan $paymentPlan The PaymentPlan associated with the Tenant.
  * @param mixed $beginTimestamp The date and time upon which the Tenant begins to be operational.
  * @param mixed $endTimestamp The date and time upon which the Tenant ceases to be operational.
  * @param array $dataCenters An array of DataCenters to associate with the Tenant.
  * @return \PhoenixSNS\Objects\Tenant|NULL
  */
 public static function Create($url, $description = null, $status = TenantStatus::Enabled, TenantType $type = null, PaymentPlan $paymentPlan = null, $beginTimestamp = null, $endTimestamp = null, array $dataCenters = null)
 {
     $item = new Tenant();
     $item->URL = $url;
     $item->Description = $description;
     $item->Status = $status;
     $item->Type = $type;
     $item->PaymentPlan = $paymentPlan;
     $item->BeginTimestamp = $beginTimestamp;
     $item->EndTimestamp = $endTimestamp;
     if ($dataCenters == null) {
         $dataCenters = array();
     }
     foreach ($dataCenters as $datacenter) {
         $item->DataCenters->Add($datacenter);
     }
     if ($item->Update()) {
         return $item;
     }
     return null;
 }