public function setFromDataBaseRow($data) { $this->id = $data['id']; $this->site_id = $data['site_id']; $this->site_slug = isset($data['site_slug']) ? $data['site_slug'] : null; $this->slug = $data['slug']; $this->summary = $data['summary']; $this->description = $data['description']; $utc = new \DateTimeZone("UTC"); $this->start_at = new \DateTime($data['start_at'], $utc); $this->end_at = new \DateTime($data['end_at'], $utc); $this->created_at = new \DateTime($data['created_at'], $utc); $this->group_id = isset($data['group_id']) ? $data['group_id'] : null; $this->group_title = isset($data['group_title']) ? $data['group_title'] : null; $this->is_deleted = $data['is_deleted']; $this->is_cancelled = $data['is_cancelled']; $this->event_recur_set_id = $data['event_recur_set_id']; $this->country_id = $data['country_id']; $this->venue_id = $data['venue_id']; $this->area_id = $data['area_id']; $this->timezone = $data['timezone']; $this->import_id = $data['import_id']; $this->import_url_id = $data['import_url_id']; $this->url = $data['url']; $this->ticket_url = $data['ticket_url']; if (isset($data['venue_slug'])) { $this->venue = new VenueModel(); $this->venue->setTitle($data['venue_title']); $this->venue->setSlug($data['venue_slug']); $this->venue->setLat($data['venue_lat']); $this->venue->setLng($data['venue_lng']); $this->venue->setDescription($data['venue_description']); $this->venue->setAddress($data['venue_address']); $this->venue->setAddressCode($data['venue_address_code']); } if (isset($data['area_slug'])) { $this->area = new AreaModel(); $this->area->setId($data['area_information_id']); $this->area->setTitle($data['area_title']); $this->area->setSlug($data['area_slug']); } if (isset($data['country_two_char_code'])) { $this->country = new CountryModel(); $this->country->setTwoCharCode($data['country_two_char_code']); $this->country->setTitle($data['country_title']); } $this->user_is_plan_attending = isset($data['user_is_plan_attending']) ? (bool) $data['user_is_plan_attending'] : false; $this->user_is_plan_maybe_attending = isset($data['user_is_plan_maybe_attending']) ? (bool) $data['user_is_plan_maybe_attending'] : false; $this->is_virtual = (bool) $data['is_virtual']; $this->is_physical = (bool) $data['is_physical']; $this->is_duplicate_of_id = $data['is_duplicate_of_id']; $this->is_event_in_curated_list = isset($data['is_event_in_curated_list']) ? (bool) $data['is_event_in_curated_list'] : false; $this->in_curated_list_group_id = isset($data['in_curated_list_group_id']) ? $data['in_curated_list_group_id'] : null; $this->in_curated_list_group_slug = isset($data['in_curated_list_group_slug']) ? $data['in_curated_list_group_slug'] : null; $this->in_curated_list_group_title = isset($data['in_curated_list_group_title']) ? $data['in_curated_list_group_title'] : null; $this->media_event_slugs = isset($data['media_event_slugs']) ? $data['media_event_slugs'] : null; $this->media_group_slugs = isset($data['media_group_slugs']) ? $data['media_group_slugs'] : null; $this->media_venue_slugs = isset($data['media_venue_slugs']) ? $data['media_venue_slugs'] : null; if ($data['custom_fields'] && $data['custom_fields'] != '[]') { $obj = json_decode($data['custom_fields']); foreach (get_object_vars($obj) as $k => $v) { $this->custom_fields[$k] = $v; } } }