protected function saveEventMembers(int $iEventId, array $aMembers)
    {
        if (!empty($aMembers)) {
            $aExecParams[':sked_event_id'] = $iEventId;
            $strQuery = 'INSERT IGNORE INTO `sked_event_members`
                (`sked_event_id`, `member_id`, `owner`, `lead_time`, `created_at`) VALUES ';

            $aValueSets = [];
            foreach ($aMembers as $iMemberId => $aSettings) {
                $strMemberParam = ':member_id_' . $iMemberId;
                $strOwnerParam = ':owner_' . $iMemberId;
                $strLeadTimeParam = ':lead_time_' . $iMemberId;
                $aValueSets[] = '(:sked_event_id, ' . $strMemberParam . ', '
                    . $strOwnerParam . ', ' . $strLeadTimeParam . ', NOW())';
                $aExecParams[$strMemberParam] = $iMemberId;
                $aExecParams[$strOwnerParam] = $aSettings['owner'] ?? 0;
                $aExecParams[$strLeadTimeParam] = $aSettings['lead_time'] ?? 0;
            }

            $strQuery .= implode(',', $aValueSets) . ' ON DUPLICATE KEY UPDATE'
                . ' `owner` = VALUES(`owner`), `lead_time` = VALUES(`lead_time`)';

            $this->queryPDO($strQuery, $aExecParams);
        }

        return true;
    }
protected function saveEventMembers(int $iEventId, array $aMembers)
    {
        if (!empty($aMembers)) {
            $aExecParams[':sked_event_id'] = $iEventId;
            $strQuery = 'INSERT IGNORE INTO `sked_event_members`
                (`sked_event_id`, `member_id`, `owner`, `lead_time`, `created_at`) VALUES ';

            $aValueSets = [];
            foreach ($aMembers as $iMemberId => $aSettings) {
                $strMemberParam = ':member_id_' . $iMemberId;
                $strOwnerParam = ':owner_' . $iMemberId;
                $strLeadTimeParam = ':lead_time_' . $iMemberId;
                $aValueSets[] = '(:sked_event_id, ' . $strMemberParam . ', '
                    . $strOwnerParam . ', ' . $strLeadTimeParam . ', NOW())';
                $aExecParams[$strMemberParam] = $iMemberId;
                $aExecParams[$strOwnerParam] = $aSettings['owner'] ?? 0;
                $aExecParams[$strLeadTimeParam] = $aSettings['lead_time'] ?? 0;
            }

            $strQuery .= implode(',', $aValueSets) . ' ON DUPLICATE KEY UPDATE'
                . ' `owner` = VALUES(`owner`), `lead_time` = VALUES(`lead_time`)';

            $this->queryPDO($strQuery, $aExecParams);
        }

        return true;
    }
protected function saveEventMembers ( int $ iEventId , array $ aMembers ) { if ( ! empty ( $ aMembers ) ) { $ aExecParams [ ':sked_event_id' ] = $ iEventId ; $ strQuery = 'INSERT IGNORE INTO `sked_event_members`
                (`sked_event_id`, `member_id`, `owner`, `lead_time`, `created_at`) VALUES ' ; $ aValueSets = [ ] ; foreach ( $ aMembers as $ iMemberId => $ aSettings ) { $ strMemberParam = ':member_id_' . $ iMemberId ; $ strOwnerParam = ':owner_' . $ iMemberId ; $ strLeadTimeParam = ':lead_time_' . $ iMemberId ; $ aValueSets [ ] = '(:sked_event_id, ' . $ strMemberParam . ', ' . $ strOwnerParam . ', ' . $ strLeadTimeParam . ', NOW())' ; $ aExecParams [ $ strMemberParam ] = $ iMemberId ; $ aExecParams [ $ strOwnerParam ] = $ aSettings [ 'owner' ] ?? 0 ; $ aExecParams [ $ strLeadTimeParam ] = $ aSettings [ 'lead_time' ] ?? 0 ; } $ strQuery .= implode ( ',' , $ aValueSets ) . ' ON DUPLICATE KEY UPDATE' . ' `owner` = VALUES(`owner`), `lead_time` = VALUES(`lead_time`)' ; $ this -> queryPDO ( $ strQuery , $ aExecParams ) ; } return true ; }
Persist event member data to the database.

@param int $iEventId Event that owns the tags.
@param array $aMembers Array of data to persist.
@return bool Success/failure.
Persist event member data to the database .