Nov 04

CakePHPで SoftDeletableBehaviors を使っているときに find()メソッドのcallbacks引数に false を指定するとBehaviorが無効になっちゃいました。

というわけでfind()の時に afterFind() をしたくないときは

$this->Task->find('all', array('conditions' => array(), 'order' => array(), 'fields' => array(), 'callbacks' => 'before'));

ってしましょう。

Oct 06

CakePHPのShellを作成するときに__()を通しても変換されなかったので、ちょっとメモ

app/vendors/shells/hogehoge.php

App::import('Core', 'L10n');
class HogehogeShell extends Shell {
  function startup() {
    $this->L10n = new L10n();
    $this->L10n->get('jpn');
  }

  function main() {
    print __('Hello World.', true);
  }
}

ってやれば大丈夫でした。

Get Adobe Flash playerPlugin by wpburn.com wordpress themes