TRAJOIN is an Application to Translate symfony documents Jointly.

home > 1.2/cookbook/en > propel_13.txt

[1] Edit ↑TOP

Propel 1.3を使う方法


[2] Edit ↑TOP

by Carl Vondrick


[3] Edit ↑TOP

symfony 1.1で始める場合、速度の改善、入れ子集合の実装、オブジェクトプーリングなどをプロジェクトで利用するために、Propel 1.3を使うことは簡単です。これらの機能の中で最も重要なことは、Propel 1.3はDBALとしてCreoleの代わりにPDOを利用するので、顕著なパフォーマンスの押し上げがあることです。


[4] Edit ↑TOP

Propel 1.3をインストールする作業は数分かかるだけです。行わなければならないのはプラグインをインストールして2つの設定ファイルを修正することです。方法をお読み下さい。


[5] Edit ↑TOP
  • symfonyのリポジトリからPropel 1.3プラグインをインストールします:

[6] Edit ↑TOP
    $ cd /path/to/project/root/
    $ svn co http://svn.symfony-project.com/plugins/sfPropelPlugin/branches/1.3/ plugins/sfPropelPlugin

[7] Edit ↑TOP
  • Propel 1.3は新しい接続フォーマットを利用するのでそれ相応にdatabases.ymlを更新しなければなりません。必要な変更を行うために、次のようにconfig/databases.ymlを変更します:

[8] Edit ↑TOP

    dev:
      propel:
        param: 
          classname: DebugPDO

    all:
      propel:
        class: sfPropelDatabase
        param:
          dsn: mysql:dbname=mydb;host=localhost 
          username: username
          password: password
          encoding: utf8
          persistent: true
          pooling: false
          classname: PropelPDO

    DSNをアップグレードするためには、[PDOのマニュアル](http://jp.php.net/manual/ja/pdo.drivers.php)をご覧下さい。

[9] Edit ↑TOP
  • 同じ設定を満たすためにpropel.iniも更新しなければなりません。config/propel.iniの始めの三行を見てそれらを削除します:

[10] Edit ↑TOP

    propel.database            = mysql
    propel.database.createUrl  = mysql://root@localhost/
    propel.database.url        = mysql://root@localhost/myproject

これらの場所に、次の内容を挿入します:

    [ini]
    propel.database            = mysql
    propel.database.driver     = mysql
    propel.database.createUrl  = mysql://localhost/
    propel.database.url        = mysql:dbname=mydb;host=localhost
    propel.database.user       = username
    propel.database.password   = password
    propel.database.encoding   = utf8

`propel.database.url`がステップ2のDSNと一致していることを確認します。

[11] Edit ↑TOP
  • symfonyの内部キャッシュを消去します:

[12] Edit ↑TOP
    $ symfony cache:clear

[13] Edit ↑TOP
  • Propel 1.3は改善されたオブジェクトモデルを持つので、モデルをリビルドしなければなりません:

[14] Edit ↑TOP
    $ symfony propel:build-model

[15] Edit ↑TOP

これが新しいプロジェクトでしたら、Propel 1.3のセットアップが成功したのでおめでとう!schema.ymlの構文はPropel 1.2のものとまったく同じです。新しいAPIは劇的に変わっていません; 実際、大部分のAPIはまったく同じです。


[16] Edit ↑TOP

プロジェクトをアップグレードする場合、少し作業を行う必要があるかもしれませんが、大抵のプロジェクトはうまくゆきます。コードの中でトランザクションもしくはCreoleを直接利用している場合、手動でPDOにアップグレードしなければなりません。Propelのプロジェクトには便利なアップグレードガイドがあります。これが新しいプロジェクトだとしても、すべての新しい機能を学ぶためにざっと眺めれば役立つでしょう。


[17] Edit ↑TOP

symfony 1.1はコアシステムを分離するので、望むORMレイヤーを使うことは簡単にはなりません。Propelではうまく行かないのであれば、 sfDoctrinePluginを試して下さい。これはPropelの代替のORMでPropel 1.3のパフォーマンスを満たします。symfony 1.1のおかげで、開発者は1.3の改善されたパフォーマンスを享受できます。確固たる安定性が必要なPropel 1.2を利用します。


Comments

Menu

Documentation



Latest Histories

symfony 1.1 decouples its ...
brtRiver(2009-01-05 04:04:42)
If you are upgrading a pr ...
brtRiver(2009-01-05 04:04:28)
If this is a new project, ...
brtRiver(2009-01-05 04:04:17)
$ symfony propel: ...
brtRiver(2009-01-05 04:04:07)
* Propel 1.3 has an imp ...
brtRiver(2009-01-05 04:03:56)
$ symfony cache:c ...
brtRiver(2009-01-05 04:03:48)
* Clear symfony's ...
brtRiver(2009-01-05 04:03:38)
[ini] pro ...
brtRiver(2009-01-05 04:03:24)
* We must update `prope ...
brtRiver(2009-01-05 04:02:27)
[yml] dev ...
brtRiver(2009-01-05 04:02:18)
* Propel 1.3 uses a new ...
brtRiver(2009-01-05 04:01:52)
$ cd /path/to/pro ...
brtRiver(2009-01-05 04:01:45)
* Install the Propel 1. ...
brtRiver(2009-01-05 04:01:36)
Installing Propel 1.3 onl ...
brtRiver(2009-01-05 04:01:27)
Starting with symfony 1.1 ...
brtRiver(2009-01-05 04:01:18)
*by Carl Vondrick* ...
brtRiver(2009-01-05 04:01:08)
How to use Propel 1.3 === ...
brtRiver(2009-01-05 04:00:55)

Untranslated