return 'images';
}
+ /**
+ * Явное указание первичного ключа.
+ *
+ * В таблице `images` отсутствует PK-конст. на уровне БД, из-за чего
+ * автоопределение через схему падает с InvalidConfigException
+ * ("must have a primary key") при вызове findOne(). Задаём PK явно.
+ *
+ * {@inheritdoc}
+ */
+ public static function primaryKey()
+ {
+ return ['id'];
+ }
+
public function behaviors()
{
if ($marketplaceOrder->status->code == 'DELIVERED' &&
$marketplaceOrder->substatus->code == 'DELIVERY_SERVICE_DELIVERED' &&
$marketplaceOrder) {
- $deliveredStatusId = $statuses['DELIVERED'];
+ $deliveredStatusId = $statuses['DELIVERED'] ?? null;
$status1cWithDeliveredId = ArrayHelper::getColumn(MarketplaceOrder1cStatuses::find()
->where(['order_status_id' => $deliveredStatusId])
->andWhere(['marketplace_id' => MarketplaceStore::YANDEX_WAREHOUSE_ID])
->asArray()
->all();
$statuses = ArrayHelper::map($statuses, 'code', 'id');
- $cancelledStatusId = $statuses[MarketplaceOrderStatusTypes::CANSELLED_CODE];
- $deliveredStatusId = $statuses['DELIVERED'];
+ $cancelledStatusId = $statuses[MarketplaceOrderStatusTypes::CANSELLED_CODE] ?? null;
+ $deliveredStatusId = $statuses['DELIVERED'] ?? null;
$status1cWithCancelledId = ArrayHelper::getColumn(MarketplaceOrder1cStatuses::find()
->where(['order_status_id' => $cancelledStatusId])
->andWhere(['marketplace_id' => MarketplaceStore::FLOWWOW_WAREHOUSE_ID])
}
try {
- if (Yii::$app && Yii::$app->has('queue')) {
- Yii::$app->queue->push(new \app\jobs\SendTelegramMessageJob([
- 'message' => $message,
- ]));
- }
+ // Системный алерт уходит в служебный канал. SendTelegramMessageJob
+ // не подходит — он для клиентских рассылок (требует chat_id/phone),
+ // и его ключ message приводил к "unknown property" → алерт не отправлялся.
+ \yii_app\services\TelegramService::sendErrorToTelegramMessage(
+ $message,
+ false,
+ \yii_app\services\TelegramService::isDevEnv()
+ );
} catch (\Throwable $e) {
try {
Yii::error("Failed to send Telegram alert: " . $e->getMessage(), 'stock-state');