27 lines
514 B
PHP
27 lines
514 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KupShop\KafkaBundle\Util;
|
|
|
|
use KupShop\KupShopBundle\Config;
|
|
|
|
trait KafkaUtilTrait
|
|
{
|
|
public function getShopTopicName(string $topic): string
|
|
{
|
|
$dbName = Config::get()['Connection']['database'];
|
|
|
|
if (isLocalDevelopment()) {
|
|
return $dbName;
|
|
}
|
|
|
|
return $topic.'_'.$dbName;
|
|
}
|
|
|
|
public function getShopGroupId(string $groupId): string
|
|
{
|
|
return Config::get()['Connection']['database'].'-'.$groupId;
|
|
}
|
|
}
|