Example #1
0
 protected static function createBaseFromData(\stdClass $data)
 {
     $object = new static();
     $object->type = $data->type;
     $object->uuid = $data->uuid;
     $object->revisionHash = $data->hash;
     $object->availableLanguageCodes = $data->languages;
     $object->status = $data->status;
     $object->contentProvider = ContentProvider::createFromData($data->content_provider);
     if (isset($data->location)) {
         $object->location = Location::createFromData($data->location);
     }
     if (isset($data->trigger_zones)) {
         foreach ($data->trigger_zones as $triggerZoneData) {
             $object->triggerZones[] = TriggerZone::createFromData($triggerZoneData);
         }
     }
     if (isset($data->purchase)) {
         $object->purchase = Purchase::createFromData($data->purchase);
     }
     if (isset($data->publisher)) {
         $object->publisher = PublisherBase::createFromData($data->publisher);
     }
     if (isset($data->city)) {
         $object->city = CityBase::createFromData($data->city);
     }
     if (isset($data->country)) {
         $object->country = CountryBase::createFromData($data->country);
     }
     return $object;
 }
Example #2
0
 /**
  * Returns the static model of the specified AR class.
  * @return User the static model class
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }