付録 B - カスタムインストーラの例
次の PHP コードは、第6章で使われているカスタムインストーラです:
<?php $this->logSection('install', 'default to sqlite'); $this->runTask('configure:database', sprintf("'sqlite:%s/database.db'", sfConfig::get('sf_data_dir'))); $this->logSection('install', 'create an application'); $this->runTask('generate:app', 'frontend'); $this->setConfiguration($this->createConfiguration('frontend', 'dev')); $this->logSection('install', 'publish assets'); $this->runTask('plugin:publish-assets'); if (file_exists($dir = sfConfig::get('sf_symfony_lib_dir').'/../data')) { $this->installDir($dir); } $this->logSection('install', 'create the database schema'); file_put_contents(sfConfig::get('sf_config_dir').'/doctrine/schema.yml', <<<EOF Product: columns: name: { type: string(255), notnull: true } price: { type: decimal, notnull: true } ProductPhoto: columns: product_id: { type: integer } filename: { type: string(255) } caption: { type: string(255), notnull: true } relations: Product: alias: Product foreignType: many foreignAlias: Photos onDelete: cascade EOF ); $this->logSection('install', 'add some fixtures'); file_put_contents(sfConfig::get('sf_data_dir').'/fixtures/fixtures.yml', <<<EOF Product: product_1: name: Product Name price: 25.95 EOF ); $this->logSection('install', 'build the model'); $this->runTask('doctrine:build', '--all --and-load --no-confirmation'); $this->logSection('install', 'create a simple CRUD module'); $this->runTask('doctrine:generate-module', 'frontend product Product --non-verbose-templates'); $this->logSection('install', 'fix sqlite database permissions'); chmod(sfConfig::get('sf_data_dir'), 0777); chmod(sfConfig::get('sf_data_dir').'/database.db', 0777);
インデックス
Document Index
関連ページリスト
Related Pages
はじめに
進化したルーティング
生産性を高める
メール
カスタムウィジェットとバリデータ
高度なフォーム
Web デバッグツールバーの拡張
Doctrine の高度な使用方法
Doctrine のテーブル継承の活用
symfony の内側
Windows と symfony
Facebook のための開発
コマンドラインとタスクの活用
symfonyのコンフィグキャッシュで遊ぶ
symfony コミュニティで活動する
付録 A - sfWidgetFormGMapAddressのJavaScript コード
著者の紹介
付録 B - カスタムインストーラの例
付録 C - ライセンス
翻訳者の紹介

日本語ドキュメント
Japanese Documents
2011/01/18 Chapter 17 - Extending Symfony
2011/01/18 The generator.yml Configuration File
2011/01/18 Les tâches
2011/01/18 Emails
2010/11/26 blogチュートリアル(8) ビューの作成

