Windows環境でSymfony2のconsoleを使う
目下Symfony2勉強中です。一通りチュートリアルのツアーの日本語訳があったので、こちらを読んでみました。
Scopenote: Symfony2 クイックツアー 第1部
だいたい一通り飲み込めたかなってところで、最後の方を読んでいると、Ethnaにおけるethnaコマンドのような、スケルトンを生成したりするconsoleっていうのがあるらしい。
まあようはPHPを使うので、WebMatrixの環境で簡単に立ち上げられるバッチファイルを書いてみました。
@echo off setlocal set webmatrixphp=\IIS Express\php\v5.3\php.exe if "%ProgramFiles(x86)%" NEQ "" ( set phpcmd="%ProgramFiles(x86)%%webmatrixphp%" ) else ( set phpcmd="%ProgramFiles%%webmatrixphp%" ) cd %~dp0\.. %phpcmd% "%~dp0\console" --shell
これを Symfony\app に console.bat という名前でおきました。
で、実行するとこんなエラー。
[RuntimeException]
Unable to start the shell as the Readline extension is not enabled.
Readline拡張モジュールがないっていうエラーですね。この拡張モジュール、Windowsでは使用できません。
シェルモードが使えないだけで、普通のコマンドは実行できるみたいです。
@echo off setlocal set webmatrixphp=\IIS Express\php\v5.3\php.exe if "%ProgramFiles(x86)%" NEQ "" ( set phpcmd="%ProgramFiles(x86)%%webmatrixphp%" ) else ( set phpcmd="%ProgramFiles%%webmatrixphp%" ) cd %~dp0\.. %phpcmd% "%~dp0\console" %1 %2 %3 %4
こんな感じで修正して、Symfony\app へ移動してconsoleってたたけばこんな感じに。
C:\Users\iseebi\Documents\My Web Sites\WebSite1\Symfony\app>console list Symfony version 2.0.0-DEV - app/dev/debug Usage: [options] command [arguments] Options: --help -h Display this help message. --quiet -q Do not output any message. --verbose -v Increase verbosity of messages. --version -V Display this program version. --ansi -a Force ANSI output. --no-interaction -n Do not ask any interactive question. --shell -s Launch the shell. --env -e The Environment name. --no-debug Switches off debug mode. Available commands: help Displays help for a command (?) list Lists commands assetic :dump Dumps all assets to the filesystem assets :install cache :clear Clear the cache :warmup Warms up an empty cache container :debug Displays current services for an application doctrine :ensure-production-settings Verify that Doctrine is properly configured for a production environment. doctrine:cache :clear-metadata Clear all metadata cache for a entity manager. :clear-query Clear all query cache for a entity manager. :clear-result Clear result cache for a entity manager. doctrine:data :load Load data fixtures to your database. doctrine:database :create Create the configured databases. :drop Drop the configured databases. doctrine:generate :entities Generate entity classes and method stubs from you r mapping information. :entity Generate a new Doctrine entity inside a bundle. :proxies Generates proxy classes for entity classes. :repositories Generate repository classes from your mapping inf ormation. doctrine:mapping :convert Convert mapping information between supported for mats. :import Import mapping information from an existing datab ase. :info Show basic information about all mapped entities. doctrine:query :dql Executes arbitrary DQL directly from the command line. :sql Executes arbitrary SQL directly from the command line. doctrine:schema :create Processes the schema and either create it directl y on EntityManager Storage Connection or generate the SQL output. :drop Drop the complete database schema of EntityManage r Storage Connection or generate the corresponding SQL output. :update Processes the schema and either update the databa se schema of EntityManager Storage Connection or generate the SQL output. init :acl :bundle router :debug Displays current routes for an application :dump-apache Dumps all routes as Apache rewrite rules swiftmailer:spool :send Send emails from the spool
何が何を意味するのかまだわかりませんがそれは追々。