Example #1
0
 /**
  * Creates the container object
  *
  * Creates a new container object or, if the $cdata object is a string,
  * retrieves the named container from the object store. If $cdata is an
  * array or an object, then its values are used to set this object.
  *
  * @param OpenCloud\ObjectStore $service - the ObjectStore service
  * @param mixed $cdata - if supplied, the name of the object
  */
 public function __construct(AbstractService $service, $cdata = null)
 {
     $this->getLogger()->info('Initializing CDN Container Service...');
     parent::__construct();
     $this->service = $service;
     // Populate data if set
     $this->populate($cdata);
 }
Example #2
0
 /**
  * A DataObject is related to a container and has a name
  *
  * If `$name` is specified, then it attempts to retrieve the object from the
  * object store.
  *
  * @param Container $container the container holding this object
  * @param mixed $cdata if an object or array, it is treated as values
  *      with which to populate the object. If it is a string, it is
  *      treated as a name and the object's info is retrieved from
  *      the service.
  * @return void
  */
 public function __construct($container, $cdata = null)
 {
     parent::__construct();
     $this->container = $container;
     // For pseudo-directories, we need to ensure the name is set
     if (!empty($cdata->subdir)) {
         $this->name = $cdata->subdir;
         $this->directory = true;
     } else {
         $this->populate($cdata);
     }
 }