The symfony and Doctrine book

1章 - 始める

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


About

You are currently reading "The symfony and Doctrine book" which is licensed under the GFDL license.

Master symfony

Be trained by SensioLabs experts (2 to 6 day sessions -- French or English).
trainings.sensiolabs.com

Books on symfony

Learn more about symfony with the official guides.
books.sensiolabs.com

L'audit Qualité par SensioLabs

200 points de contrôle de votre applicatif web.
audit.sensiolabs.com

Chapter Content

Doctrineとは?

Doctrineを有効にする

利用可能なタスク

symfony training
Be trained by symfony experts
May 29: Paris (Web Development with Symfony2 - Français)
May 31: Paris (Mastering Symfony2 - Français)
Jun 06: Paris (Introduction to Symfony2 - Français)
Jun 06: Paris (Introduction to Symfony2 - English)
Jun 06: Paris (Going Further with Symfony2 - English)
and more...

Search


powered by google
You are currently browsing "The symfony and Doctrine book" in Japanese for the 1.2 version - Switch to language:
This work is licensed under a GFDL license.
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

このチュートリアルではDoctrineに関するすべての詳細な内容を説明しません。 ここではsymfonyを最大限活用するために精選した題目を手短にふれることにします。 Doctrineのすべてに関する内容はDoctrineの公式マニュアルが最良のソースです。 このチュートリアルではDoctrine固有の話について公式マニュアルを活用するための手助けをすることを目的としています。>Doctrineのメインドキュメントはここから見ることができます。

Doctrineとは?

DoctrineはPHPで書かれたORM(Object Relational Mapper: オブジェクトリレーショナルマッパー)でPHP5.2.3以降では最も強力なDBAL(DataBase Abstract Layer: データベース抽象化レイヤー)の1つです。 重要な機能の1つはDQLと呼ばれるオブジェクト指向のSQL方言を書けることです。 DQLはJavaで書かれたHibernatesにインスパイアされました。 Doctrineはコードを重複せずに最大限の柔軟性を維持しSQLの代わりとなる機能を開発者に提供します。

Doctrineを有効にする

Doctrineを使い始めるには、config/ProjectConfiguration.class.phpsetup()メソッドを編集してsfDoctrinePluginを有効にしてsfPropelPluginを無効にしなければなりません。

public function setup()
{
  $this->enablePlugins(array('sfDoctrinePlugin'));
  $this->disablePlugins(array('sfPropelPlugin'));
}

デフォルトのプラグインすべてを有効にしたければ、次のようにできます:

public function setup()
{
  $this->enableAllPluginsExcept(array('sfPropelPlugin', 'sfCompat10Plugin'));
}

推奨されませんが、DoctrineとPropelは共存できます。sfPropelPluginを無効にしないでsfDoctrinePluginを有効にすればうまくゆきます。

利用可能なタスク

sfDoctrinePluginで利用できる完全なタスクの一覧は下記の通りです(訳注:実際のメッセージは英語です)。 sfDoctrinePluginはsfPropelPluginのすべての機能だけでなく、さらに多くの機能を提供します。

$ ./symfony list doctrine
使い方:
  symfony [options] task_name [arguments]

オプション:
  --dry-run     -n  アクションを実行せず予行演習を行う
  --help        -H  ヘルプメッセージを表示する
  --quiet       -q  標準出力にメッセージを記録しない
  --trace       -t  トレーシングの起動/実行をオンにし、フルバックトレースを有効にする
  --version     -V  プログラムのバージョンを表示する

"doctrine" の名前空間で利用できるタスク:
  :build-all                   Doctrineのモデル、SQLを生成し、データベースを初期化する (doctrine-build-all)
  :build-all-load              Doctrineのモデル、SQLを生成し、データベースを初期化し、データをロードする (doctrine-build-all-load)
  :build-all-reload            Doctrineのモデル、SQLを生成し、データベースを初期化し、データをリロードする (doctrine-build-all-reload)
  :build-all-reload-test-all   Doctrineのモデル、SQLを生成し、データベースを初期化し、データをロードしてすべてのテストスイートを実行する (doctrine-build-all-reload-test-all)
  :build-db                    現在のモデル用のデータベースを作成する (doctrine-build-db)
  :build-filters               現在のモデル用のフィルタフォームクラスを作成する
  :build-forms                 現在のモデル用のフォームクラスを作成する (doctrine-build-forms)
  :build-model                 現在のモデル用のクラスを作成する (doctrine-build-model)
  :build-schema                既存のデータベースからスキーマを作成する (doctrine-build-schema)
  :build-sql                   現在のモデル用のSQLを作成する (doctrine-build-sql)
  :data-dump                   データをフィクスチャディレクトリにダンプする (doctrine-dump-data)
  :data-load                   フィクスチャディレクトリからデータをロードする (doctrine-load-data)
  :dql                         DQLクエリを実行して結果を見る (doctrine-dql)
  :drop-db                     現在のモデル用のデータベースを削除する (doctrine-drop-db)
  :generate-admin              Doctrineのadminモジュールを生成する
  :generate-migration          マイグレーションクラスを生成する (doctrine-generate-migration)
  :generate-migrations-db      既存のデータベース接続からマイグレーションクラスを生成する (doctrine-generate-migrations-db, doctrine-gen-migrations-from-db)
  :generate-migrations-models  既存のモデルのセットからマイグレーションクラスを生成する (doctrine-generate-migrations-models, doctrine-gen-migrations-from-models)
  :generate-module             Doctrineモジュールを生成する (doctrine-generate-crud, doctrine:generate-crud)
  :generate-module-for-route   ルーティングの定義用にDoctrineモジュールを生成する
  :insert-sql                  現在のモデル用にSQLを挿入する (doctrine-insert-sql)
  :migrate                     データベースを現在の/指定されたバージョンにマイグレートする (doctrine-migrate)
  :rebuild-db                  現在のモデル用のデータベースを作成する (doctrine-rebuild-db)
2章 - 接続 »

Questions & Feedback

If you find a typo or an error, please register and open a ticket.

If you need support or have a technical question, please post to the official user mailing-list.