<commit_before><?php

namespace Ridibooks\Platform\Common\Base;

use Ridibooks\Library\DB\ConnectionProvider;
use Ridibooks\Library\DB\GnfConnectionProvider;

class AdminBaseModel
{
    protected $db;
    protected $read_db;

    public function __construct()
    {
        $this->db = self::getDb();
        $this->read_db = self::getReadDb();
    }

    protected static function getDb()
    {
        return GnfConnectionProvider::getConnection(ConnectionProvider::CONNECTION_GROUP_PLATFORM_WRITE);
    }

    protected static function getReadDb()
    {
        return GnfConnectionProvider::getConnection(ConnectionProvider::CONNECTION_GROUP_PLATFORM_READ);
    }

    protected static function getPlatformOnlyWritableDb()
    {
        return GnfConnectionProvider::getConnection(ConnectionProvider::CONNECTION_GROUP_PLATFORM_ONLY_DB_WRITE);
    }

    protected static function getPlatformOnlyReadDb()
    {
        return GnfConnectionProvider::getConnection(ConnectionProvider::CONNECTION_GROUP_PLATFORM_ONLY_DB_READ);
    }

    protected static function getCpWritableDb()
    {
        return GnfConnectionProvider::getConnection(ConnectionProvider::CONNECTION_GROUP_CP_STATISTICS);
    }

    protected static function getCpReadDb()
    {
        return GnfConnectionProvider::getConnection(ConnectionProvider::CONNECTION_GROUP_CP_STATISTICS_READ);
    }

    /**
     * 트랜잭셔널 (모델이 아닌 서비스에서 명시적인 트랜잭션이 필요할 경우 사용)
     * @param $func callable
     * @return bool
     * @throws \Exception
     */
    public static function transactional($func)
    {
        $db = self::getDb();
        return $db->transactional($func);
    }
}
<commit_msg>Change connection group class reference - ConnectionProvider -> PlatformConnectionGroup <2><commit_after><?php

namespace Ridibooks\Platform\Common\Base;

use Ridibooks\Library\DB\GnfConnectionProvider;
use Ridibooks\Platform\Common\Constant\PlatformConnectionGroup;

class AdminBaseModel
{
    protected $db;
    protected $read_db;

    public function __construct()
    {
        $this->db = self::getDb();
        $this->read_db = self::getReadDb();
    }

    protected static function getDb()
    {
        return GnfConnectionProvider::getConnection(PlatformConnectionGroup::PLATFORM_WRITE);
    }

    protected static function getReadDb()
    {
        return GnfConnectionProvider::getConnection(PlatformConnectionGroup::PLATFORM_READ);
    }

    protected static function getPlatformOnlyWritableDb()
    {
        return GnfConnectionProvider::getConnection(PlatformConnectionGroup::PLATFORM_ONLY_DB_WRITE);
    }

    protected static function getPlatformOnlyReadDb()
    {
        return GnfConnectionProvider::getConnection(PlatformConnectionGroup::PLATFORM_ONLY_DB_READ);
    }

    protected static function getCpWritableDb()
    {
        return GnfConnectionProvider::getConnection(PlatformConnectionGroup::CP_STATISTICS);
    }

    protected static function getCpReadDb()
    {
        return GnfConnectionProvider::getConnection(PlatformConnectionGroup::CP_STATISTICS_READ);
    }

    /**
     * 트랜잭셔널 (모델이 아닌 서비스에서 명시적인 트랜잭션이 필요할 경우 사용)
     * @param $func callable
     * @return bool
     * @throws \Exception
     */
    public static function transactional($func)
    {
        $db = self::getDb();

        return $db->transactional($func);
    }
}

{'fraction_non_alphanumeric': 0.0894894894894895, 'fraction_numerical': 0.0003003003003003003, 'mean_word_length': 3.718130311614731, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7362014', 'n_tokens_mistral': 1014, 'n_tokens_neox': 1030, 'n_words': 167}