Пример #1
0
 /**
  * Modelクラス:初期設定
  *
  * ※Shop毎にDB参照先を切り替えています
  */
 public function init_models()
 {
     $shard = $this->get_shop_shard();
     if (is_null($shard) or empty($shard)) {
         throw new Exception('client shard info is null.');
     }
     \Model_Crud_Shard::set_connection($shard);
     $shard_payment = $this->get_payment_shard();
     if (is_null($shard_payment) or empty($shard_payment)) {
         throw new Exception('payment shard is null.');
     }
     \Model_Crud_Shard_Payment::set_connection($shard_payment);
 }
Пример #2
0
 /**
  * シャーディング指定によってDB参照先切り替え処理
  *
  * @throws Exception
  */
 public function setup()
 {
     if (is_null(self::$_client_id)) {
         return;
     }
     $shard = $this->shop_shard();
     if (!is_null($shard) and !empty($shard)) {
         \Model_Crud_Shard::set_connection($shard);
     }
     $shard_payment = $this->payment_shard();
     if (!is_null($shard_payment) and !empty($shard_payment)) {
         \Model_Crud_Shard_Payment::set_connection($shard_payment);
     }
 }
 /**
  * DB接続設定キー値をセット
  *
  * @param string $conn
  */
 public static function set_connection($conn)
 {
     self::$_connection = $conn;
 }