現在Webシステムの開発は、symfony+doctrineで行っていますが、doctrineに関しての情報が少ないので、 ちょっとしたテクニックをご紹介します。 Doctrineはデフォルトで複数DB接続の切替が可能ですが、あらかじめ使用するDBが確定している事が前提です。 ただ、以下のようなケースはちょっと工夫が必要となります。 ① 登録ユーザー毎に、DBを分ける ②ユーザー毎のDB定義は同じ。 通常であればDBを切り替える場合、databases.ymlに以下のように記述します。 all: user1: ← 接続名 ~ user2: ← 接続名 ~ しかし、ユーザー毎のDB定義が同じだと、doctrine:build-modelで作成されるクラス名が 同じになる為、問題となります。また、ユーザーが増える度にコマンドを叩くのは手間 がかかります。 で、どうするかと