LoginSignup
7
7

More than 5 years have passed since last update.

別DBにあるテーブルのアクセス

Posted at

はじめに

複数店舗で商品情報を共通化したいとのこと。
別DBに保存してあるテーブルを参照、更新できるのか試す。
まさしくこれなのでEC-CUBE4に合わせてみる。

Entity @ORM\Table

app/Customize/Entity/ProductSize.php
/**
 * ProductSize
 *
 * @ORM\Table(name="eccube4x.dtb_product_size")
 * @ORM\InheritanceType("SINGLE_TABLE")
 * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
 * @ORM\HasLifecycleCallbacks()
 * @ORM\Entity(repositoryClass="Customize\Repository\ProductSizeRepository")
 */
class ProductSize extends \Eccube\Entity\AbstractEntity
{
  :
}

@ORM\TableのnameでDB名を付加

これで特に問題なく別DBのテーブルをアクセスできそう。

参照

EC-CUBEで複数DBで会員データを共通化する

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7