LoginSignup
1
1

More than 5 years have passed since last update.

Symfonyのセットアップ

Last updated at Posted at 2014-05-24

1. インストール時にやること

(1)web/app_dev.phpの下記の行をコメントアウト。

if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1'))
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

(2)app/autoload.phpに下記を追加

<?php
umask(0000);

(3)バンドルを作成する

app/console generate:bundle

2. 不要なバンドルの削除

AcmeDemoBundleというサンプル用のバンドルが用意されているのでこれを削除する。
(1)app/AppKernel.phpから下記の行を削除

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
        }

(2)app/config/routing_dev.ymlからAcmeDemoBundleへのルーティングを削除する
(3)rm -rf src/Acme/する

3. Entityの作成
DBを作成後Entityを自動生成する。最初にparameter.ymlでDBの設定を忘れずに。
(下記URL参照)
http://docs.symfony.gr.jp/symfony2/cookbook/doctrine/reverse_engineering.html

4. カスタムリポジトリの作成
http://tutorial.symblog.co.uk/docs/extending-the-model-blog-comments.html

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1