symfony 1.3 で定義されているイベント一覧


grepで抽出してみました。(application.logとcommand.logは除外)
symfony 1.x legacy website

admin.build_criteria
plugins/sfPropelPlugin/data/generator/sfPropelModule/admin/parts/paginationAction.php
admin.build_query
plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/paginationAction.php
admin.delete_object
plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/deleteAction.php
admin.delete_object
plugins/sfPropelPlugin/data/generator/sfPropelModule/admin/parts/batchAction.php
admin.delete_object
plugins/sfPropelPlugin/data/generator/sfPropelModule/admin/parts/deleteAction.php
admin.pre_execute
plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/actions/actions.class.php
admin.pre_execute
plugins/sfPropelPlugin/data/generator/sfPropelModule/admin/template/actions/actions.class.php
admin.save_object
plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/processFormAction.php
admin.save_object
plugins/sfPropelPlugin/data/generator/sfPropelModule/admin/parts/processFormAction.php
application.throw_exception
exception/sfException.class.php
autoload.filter_config
config/sfAutoloadConfigHandler.class.php
command.filter_options
task/sfBaseTask.class.php
command.filter_options
task/sfTask.class.php
command.post_command
task/sfBaseTask.class.php
command.post_command
task/sfTask.class.php
command.pre_command
task/sfBaseTask.class.php
command.pre_command
task/sfTask.class.php
component.method_not_found
action/sfComponent.class.php
configuration.method_not_found
config/sfProjectConfiguration.class.php
context.load_factories
util/sfContext.class.php
context.method_not_found
util/sfContext.class.php
controller.change_action
controller/sfController.class.php
controller.method_not_found
controller/sfController.class.php
controller.page_not_found
controller/sfController.class.php
debug.web.filter_logs
debug/sfWebDebugPanelLogs.class.php
debug.web.load_panels
debug/sfWebDebug.class.php
debug.web.view.filter_parameter_html
debug/sfWebDebugPanelView.class.php
doctrine.configure
plugins/sfDoctrinePlugin/config/sfDoctrinePluginConfiguration.class.php
doctrine.configure_connection
plugins/sfDoctrinePlugin/lib/database/sfDoctrineDatabase.class.php
doctrine.filter_cli_config
plugins/sfDoctrinePlugin/config/sfDoctrinePluginConfiguration.class.php
doctrine.filter_model_builder_options
plugins/sfDoctrinePlugin/config/sfDoctrinePluginConfiguration.class.php
form.filter_values
form/addon/sfFormSymfony.class.php
form.method_not_found
form/addon/sfFormSymfony.class.php
form.post_configure
form/addon/sfFormSymfony.class.php
form.validation_error
form/addon/sfFormSymfony.class.php
mailer.configure
mailer/sfMailer.class.php
plugin.post_install
plugin/sfPluginManager.class.php
plugin.post_uninstall
plugin/sfPluginManager.class.php
plugin.pre_install
plugin/sfPluginManager.class.php
plugin.pre_uninstall
plugin/sfPluginManager.class.php
propel.configure
plugins/sfPropelPlugin/config/sfPropelPluginConfiguration.class.php
propel.filter_connection_config
plugins/sfPropelPlugin/lib/database/sfPropelDatabase.class.php
propel.filter_phing_args
plugins/sfPropelPlugin/lib/task/sfPropelBaseTask.class.php
request.filter_parameters
request/sfWebRequest.class.php
request.method_not_found
request/sfRequest.class.php
response.filter_content
exception/sfException.class.php
response.filter_content
response/sfResponse.class.php
response.method_not_found
response/sfResponse.class.php
routing.load_configuration
routing/sfRouting.class.php
routing.load_configuration
task/sfCommandApplicationTask.class.php
task.cache.clear
task/cache/sfCacheClearTask.class.php
task.test.filter_test_files
task/test/sfTestBaseTask.class.php
template.filter_parameters
view/sfViewParameterHolder.class.php
user.change_authentication
user/sfBasicSecurityUser.class.php
user.change_culture
user/sfUser.class.php
user.method_not_found
user/sfUser.class.php
view.cache.filter_content
view/sfViewCacheManager.class.php
view.configure_format
view/sfView.class.php
view.method_not_found
view/sfView.class.php

symfony 1.3でpeerクラスにdoSelectIteratorメソッドを追加するPropel Behavior


http://github.com/aki77/Propel-Behavior


タスク等で大量のレコードに対して処理をするとき、メモリアロケーションエラー防止の為に↓みたいに書いていたのが

<?php
$stmt = AuthorPeer::doSelectStmt(new Criteria());
while($row = $stmt->fetch(PDO::FETCH_NUM)) {
    $a = new Author();
    $a->hydrate($row);

    // ...
}

こう書けるようになります。

<?php
$it = AuthorPeer::doSelectIterator(new Criteria());
foreach ($it as $a) {
    // ...
}

symfony のスタックトレースのファイルリンクをemacsで開く


公式サイトにはTextMateでの説明しかなかったので、emacsでもできないか試してみました。
mac + Carbon Emacs の組み合わせで動作確認済みです。
スクリーンキャスト


.emacsに(server-start)を書いておく。
setteings.ymlにsf_file_link_formatの値を以下の形式で追加。

dev:
  .settings:
    file_link_format: "emacs:%f#%l"


以下のサイトを参考にdmgファイルを作成して、アプリケーションフォルダにインストール。

blog.katsuma.tv


一応完成ファイルも置いておきます。
http://dl.dropbox.com/u/136436/emacsOpen.app.dmg


AppleScript

on open location v
    if v starts with "emacs:" then
        activate
        set v to text from character 7 to character -1 of v
        set org_delimi to text item delimiters of AppleScript
        set text item delimiters of AppleScript to "#"
        set f to text item 1 of v
        set l to text item 2 of v
        set text item delimiters of AppleScript to org_delimi
        do shell script "emacsclient -n +" & l & " " & f
    end if
    quit
end open location

info.plist の追加箇所

    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLName</key>
            <string>emacs URL</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>emacs</string>
            </array>
        </dict>
    </array>
    <key>NSiUIElement</key>
    <true/>

symfony1.3のWebデバッグツールバーのDBパネルにExplain結果を表示


symfony 1.3 + propel 1.4 が対象です。

http://github.com/aki77/akWebDebugPanelPropel


sfWebDebugPanelPropel に以下の表示を追加します。

  • Explain結果の表示・警告
  • 指定回数以上のクエリが発行された場合の警告



参考サイト

gtags.el でライブラリも検索


global-5.7.6 + gtags.el-2.5で動作確認済み。


init-gtags.el

(require 'gtags)

(defvar gtags-libpath nil
  "Library directory of language.")
(make-variable-buffer-local 'gtags-libpath)

(defadvice gtags-goto-tag
  (before gtags-goto-tag-gtagslibpath activate)
  (setenv "GTAGSLIBPATH" gtags-libpath))

;; php-completion.el を使っている場合
(defadvice phpcmp-global-execute-command
  (before phpcmp-global-execute-command-gtagslibpath activate)
  (setenv "GTAGSLIBPATH" gtags-libpath))


.emacs.mine

(add-hook 'php-mode-hook
          (lambda ()
            (let ((file (buffer-file-name)))
              (cond
               ((string-match "/askeet/" file)
                (setq gtags-libpath (expand-file-name "~/local/lib/php/symfony-10/lib")))
               ((string-match "/jobeet/" file)
                (setq gtags-libpath (concat
                                     (expand-file-name "~/local/lib/php/zend/library")
                                     ":"
                                     (expand-file-name "~/local/lib/php/symfony-13/lib")
                                     )))
               (t nil)))))


global (~/.emacs.d/bin 等の優先的にパスを通してある場所に置く)

#!/bin/sh

PATH=/opt/local/bin:/usr/local/bin:/usr/bin

if [ "$1" != '-c' -a "$1" != '-cs' ]; then
    global -a "$@"
    exit $?
fi

_GTAGSPATHS=$(global -pr)

r=$?
[ $r -ne 0 ] && exit $r

[ -n "$GTAGSLIBPATH" ] && _GTAGSPATHS=$_GTAGSPATHS:$GTAGSLIBPATH

{
    IFS_SAV="$IFS"
    IFS=:

    for dir in `echo "$_GTAGSPATHS"   |
                sed -e 's/^:/.:/'     \
                    -e 's/::/:.:/g'   \
                    -e 's/:$/:./'`
    do
        GTAGSROOT=$dir global "$@"
    done

    IFS="$IFS_SAV"
} | LC_ALL=C sort -u

symfony 1.3 + Propel 1.4 で MySQLレプリケーション


ProjectConfiguration.class.php

<?php
    public function setup()
    {
        $this->dispatcher->connect(
            'propel.filter_connection_config',
            array($this, 'filterConnectionConfigEvent')
        );
    }

    public function filterConnectionConfigEvent($event, $arguments)
    {
        if ($slaves = $event['database']->getParameter('slaves')) {
            if (isset($slaves['dsn'])) {
                $slaves = $this->mergeConnectionParams($arguments['connection'], $slaves);
            } else {
                foreach ($slaves as &$slave) {
                    $slave = $this->mergeConnectionParams($arguments['connection'], $slave);
                }
            }

            $arguments['slaves']['connection'] = $slaves;
        }

        return $arguments;
    }

    protected function mergeConnectionParams($master_params, $slave_params)
    {
        if (isset($slave_params['username'])) {
            $slave_params['user'] = $slave_params['username'];
            unset($slave_params['username']);
        }
        return array_merge($master_params, $slave_params);
    }
all:
  propel:
    class:          sfPropelDatabase
    param:
      dsn:          mysql:dbname=jobeet;host=db-master;port=3306
      username:     usre
      password:     pass
      encoding:     utf8
      pooling:      true

      slaves:
        -
          dsn:          mysql:dbname=jobeet;host=db-slave1;port=3307
          username:     user
          password:     pass

モデル再構築で余計な更新が発生しないようにする


1.2 に上げたあたりから再構築のたびに、subversionで余計な更新が発生していたので設定見直し。


propel.ini

propel.addTimeStamp        = false

schema.yml

    created_at:
      type: TIMESTAMP
      required: true
      default: '0000-00-00 00:00:00'
      # default: 0000-00-00 00:00:00   これだと駄目