'', 'label' => __('Not mapped')]]; $connection = $this->resource->getConnection(); $table = $this->resource->getTableName('esun_lingxing_warehouse'); if (!$connection->isTableExists($table)) { return $options; } $rows = $connection->fetchAll($connection->select() ->from($table, ['wid', 'warehouse_name', 'source_code']) ->where('warehouse_type = ?', 3) ->where('is_deleted = ?', 0) ->where('lingxing_status = ?', 1) ->order(['warehouse_type ASC', 'warehouse_name ASC'])); foreach ($rows as $row) { $options[] = [ 'value' => (string)$row['wid'], 'label' => sprintf( '%s (WID %s%s)', $row['warehouse_name'], $row['wid'], $row['source_code'] ? ' / mapped to ' . $row['source_code'] : '' ), ]; } return $options; } }