38 return 'b_messageservice_message';
49 ->configurePrimary(
true)
50 ->configureAutocomplete(
true)
54 'validation' => [__CLASS__,
'validateType']
56 ->configureRequired(
true)
60 'validation' => [__CLASS__,
'validateSenderId']
62 ->configureRequired(
true)
67 ->configureDefaultValue(0),
70 'validation' => [__CLASS__,
'validateMessageFrom']
75 'validation' => [__CLASS__,
'validateMessageTo']
77 ->configureRequired(
true)
81 ->configureSerializationPhp()
85 ->configureRequired(
true)
98 ->configureDefaultValue(
'N')
102 'validation' => [__CLASS__,
'validateExecError']
107 ->configureDefaultValue(0)
111 'validation' => [__CLASS__,
'validateExternalId']
116 'validation' => [__CLASS__,
'validateExternalStatus']
125 public static function getByExternalId(
string $senderId,
string $externalId, ?
string $from =
null)
129 '=SENDER_ID' => $senderId,
130 '=EXTERNAL_ID' => $externalId,
146 $tableName = static::getTableName();
152 STATUS_ID = {$newStatusId}
155 AND STATUS_ID != {$newStatusId}
158 return $connection->getAffectedRowsCount() === 1;
164 $tableName = static::getTableName();
166 $newExternalStatus = $connection->getSqlHelper()->forSql($newExternalStatus);
172 STATUS_ID = {$newInternalStatusId},
173 EXTERNAL_STATUS = '{$newExternalStatus}'
176 AND STATUS_ID < {$newInternalStatusId}
179 return $connection->getAffectedRowsCount() === 1;
184 $today = (
new DateTime)->setTime(0, 0, 0);
187 '=SUCCESS_EXEC' =>
'Y',
188 '>=DATE_EXEC' => $today,
189 '=SENDER_ID' => $senderId,
190 '=MESSAGE_FROM' => $fromId,
196 $today = (
new DateTime)->setTime(0, 0, 0);
201 'SENDER_ID',
'MESSAGE_FROM',
'CNT'
204 '=SUCCESS_EXEC' =>
'Y',
205 '>=DATE_EXEC' => $today,
207 'group' => [
'SENDER_ID',
'MESSAGE_FROM'],
211 while ($row = $result->fetch())
213 $id = $row[
'SENDER_ID'] .
':'. $row[
'MESSAGE_FROM'];
214 $counts[$id] = (int)$row[
'CNT'];
223 $helper = $connection->getSqlHelper();
225 $senderId = $helper->forSql((
string)$senderId);
226 $fromId = $helper->forSql((
string)$fromId);
228 $connection->queryExecute(
"
229 UPDATE b_messageservice_message
233 AND NEXT_EXEC IS NOT NULL
234 AND SENDER_ID = '{$senderId}'
235 AND MESSAGE_FROM = '{$fromId}'
static getConnection($name="")
static getList(array $parameters=array())
static getCount($filter=array(), array $cache=array())
static getByExternalId(string $senderId, string $externalId, ?string $from=null)
static getAllDailyCount()
static validateMessageFrom()
static validateExternalId()
static validateMessageTo()
static returnDeferredToQueue($senderId, $fromId)
static validateSenderId()
static updateStatusId(int $id, int $newStatusId)
static validateExternalStatus()
static getDailyCount($senderId, $fromId)
static updateMessageStatuses($id, $newInternalStatusId, $newExternalStatus)
static validateExecError()