PieceORMコンポーネントとMDB2_Driver_pgsqlのインストール
PHPからデータベースにアクセスするには下記の方法が考えられます。
- PHPにバンドルされている各RDBMS用のエクステンションを直接使う
(抽象度: 低) - 古くはPEAR::DBに代表されるようなデータベース抽象化ライブラリを使う
(抽象度: 中) - オブジェクトリレーショナルマッピングフレームワークを使う
(抽象度: 高)
抽象度が高くなるにつれて,
Piece_
では,
PieceORMコンポーネントのインストール
> pear.bat install piece/piece_unity_component_pieceorm ... > pear.bat list -a INSTALLED PACKAGES, CHANNEL __URI: ================================== (no packages installed)
INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET: ========================================= PACKAGE VERSION STATE Archive_Tar 1.3.2 stable Cache_Lite 1.7.2 stable Console_Getopt 1.2.3 stable HTML_Template_Flexy 1.2.5 stable MDB2 2.4.1 stable Net_URL 1.0.15 stable PEAR 1.6.2 stable Structures_Graph 1.0.2 stable INSTALLED PACKAGES, CHANNEL PEAR.PIECE-FRAMEWORK.COM: ===================================================== PACKAGE VERSION STATE Piece_Examples_Basics 1.0.0 stable Piece_Flow 1.13.0 stable Piece_ORM 0.8.0 beta Piece_Right 1.7.0 stable Piece_Unity 1.1.0 stable Piece_Unity_Component_Authentication 0.13.0 beta Piece_Unity_Component_Flexy 1.1.0 stable Piece_Unity_Component_NullByteAttackPreventation 1.0.0 stable Piece_Unity_Component_PieceORM 1.1.0 stable Stagehand_FSM 1.9.0 stable INSTALLED PACKAGES, CHANNEL PECL.PHP.NET: ========================================= (no packages installed)
MDB2はそれ単体では抽象化されたAPIを定義しているにすぎませんので,
MDB2_
> pear.bat install mdb2_driver_pgsql ... > pear.bat list -a INSTALLED PACKAGES, CHANNEL __URI: ================================== (no packages installed) INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET: ========================================= PACKAGE VERSION STATE Archive_Tar 1.3.2 stable Cache_Lite 1.7.2 stable Console_Getopt 1.2.3 stable HTML_Template_Flexy 1.2.5 stable MDB2 2.4.1 stable MDB2_Driver_pgsql 1.4.1 stable Net_URL 1.0.15 stable PEAR 1.6.2 stable Structures_Graph 1.0.2 stable INSTALLED PACKAGES, CHANNEL PEAR.PIECE-FRAMEWORK.COM: ===================================================== PACKAGE VERSION STATE Piece_Examples_Basics 1.0.0 stable Piece_Flow 1.13.0 stable Piece_ORM 0.8.0 beta Piece_Right 1.7.0 stable Piece_Unity 1.1.0 stable Piece_Unity_Component_Authentication 0.13.0 beta Piece_Unity_Component_Flexy 1.1.0 stable Piece_Unity_Component_NullByteAttackPreventation 1.0.0 stable Piece_Unity_Component_PieceORM 1.1.0 stable Stagehand_FSM 1.9.0 stable INSTALLED PACKAGES, CHANNEL PECL.PHP.NET: ========================================= (no packages installed)
以上で必要なパッケージのインストールは完了です。
PieceORMコンポーネントの設定
PieceORMコンポーネントを利用するためには,
/path/
...
- name: ConfiguratorChain
point:
- name: configurators
type: extension
value:
- Configurator_PieceORM
- name: Configurator_PieceORM
point:
- name: configDirectory
type: configuration
value: ../webapp/config/orm
- name: cacheDirectory
type: configuration
value: ../webapp/cache/orm
- name: mapperConfigDirectory
type: configuration
value: ../webapp/config/orm/mappers
ConfiguratorChainプラグインの拡張ポイントconfiguratorsは,
Configurator_
設定ポイント | 概要 |
---|---|
configDirectory | Piece_ |
cacheDirectory | 各種キャッシュの配置先ディレクトリ |
mapperConfigDirectory | マッパー定義ファイルの配置先ディレクトリ |