_prepareListForAutocomplite($this->_getAttendeeByRegistrationId($data['id']))); $data['attendeeId'] = $userId['value']; $data['_attendeeId'] = $userId['title']; return $this; } protected function _updateDependency() { $this->_saveAttendeeData($this->_data); return $this; } protected function _insertDependency() { $this->_saveAttendeeData($this->_data); return $this; } protected function _saveAttendeeData(array $data) { $this->_deleteIds('TradeShowAttendee', 'registrationId'); $this->_insertAttendeeData($data); return $this; } public function getPaymentMethods4Select() { $select = $this->_db->select(); $select->from($this->_getPair('PaymentType'), ['id', 'title']); $select->where('FIND_IN_SET("admin", showFor)'); $select->order('sorter'); return $this->_db->fetchPairs($select); } protected function _getAttendeeByRegistrationId($registrationId) { $select = $this->_db->select(); $select->from( $this->_getPair('TradeShowAttendee', 'tsa'), ['id' => 'CONCAT("-", `id`)', 'attendeeId' => 'userId', 'companyName', 'firstName', 'nickname', 'lastName'] ); $select->where('`tsa`.`registrationId` = ? ', $registrationId, \Qs_Db::INT_TYPE); return $this->_db->fetchAll($select); } protected function _prepareListForAutocomplite($list) { $result = []; foreach($list as $attendee) { $result[] = [ 'value' => $attendee['attendeeId'], 'title' => TradeShowModel::getAttendeeAutocompleteTitle($attendee) ]; } return $result; } }