トップ «前月 最新 翌月» 追記

2002|01|02|03|04|05|06|07|08|11|12|
2003|01|02|03|04|05|06|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|02|03|04|07|

2008-03-11 [長年日記]

_ Zend_Controller_Dispatcher_Standardのtrunk 247行目

           if (!$this->getParam('useDefaultControllerAlways') && !empty($controller)) {

           if (!$this->getParam('useDefaultControllerAlways') && empty($controller)) {

のような気がするんだけど、いい花粉が飛んでいて頭がぼーっとするせいで、いまいち自分の判断が信用できない。ここは、useDefaultControllerAlwaysが無効な場合は、コントローラ名が解決できない→例外を発生させる処理だよな。


2008-03-12 [長年日記]

_ Zend_Db_Select::where()メソッドの$type

trunkでは、

    * @param string   $cond  The WHERE condition.
    * @param string   $value OPTIONAL A single value to quote into the condition.
    * @param constant $type  OPTIONAL The type of the given value
    * @return Zend_Db_Select This Zend_Db_Select object.
    */
   public function where($cond, $value = null, $type = null)
   {
       if ((func_num_args() > 3) or (($type !== null) and ($type !== 0) and ($type !== 1) and ($type !== 2))) {
           $value = func_get_args();
           array_shift($value);
           $type = null;
       }
       $this->_parts[self::WHERE][] = $this->_where($cond, $value, $type, true);

       return $this;
   }

なんて感じになっているんだけど、この「(($type !== null) and ($type !== 0) and ($type !== 1) and ($type !== 2))」ってのはどこから現れたんだ?

where()メソッドでは、

    * @param constant $type  OPTIONAL The type of the given value

になっているけど、ここから呼ばれている_where()メソッドでは、

    * @param string   $type   optional

になっているし、実際PDO_MYSQLを使ったZend_Db_Tableのinfo()では、DATA_TYPEはstringで返ってくる("varchar"とか"int"とか)。

0、1、2という数値から、Zend_Db::INT_TYPE = 0、Zend_Db::BIGINT_TYPE = 1、Zend_Db::FLOAT_TYPE = 2あたりが怪しそうな気がするけど、この値ってZend_Db_Adapter_Abstract内で$_numericDataTypesとして定義されて以降、まったく使われていないし、意味的にも$typeが数値ではなかった場合に$valueを配列扱いするっていう意味がわからない。

これのせいで、trunkにしたらZend_Db_Tableのリレーション周り(findParentRow()とか)が動かなくなっちゃったんだよなー(Zend_Db_Table_Row_Abstract::findParentRow()内でZend_Db_Table_Abstract::info()で取得したDATA_TYPEをそのまま渡しているため)。自前で直そうにも、コードの意味がわからなくて直せないし。

3/13追記

昨日更新されたrevision 8783で、上記の怪しげな条件文はばっさり削除された。なんだったんだ……。