<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://shiyoka.com/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://shiyoka.com/feed.php">
        <title>ClownWiki - cakephp</title>
        <description></description>
        <link>https://shiyoka.com/</link>
        <image rdf:resource="https://shiyoka.com/lib/exe/fetch.php?media=wiki:dokuwiki.svg" />
       <dc:date>2026-05-08T13:31:03+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=cakephp:1.3x_pear&amp;rev=1739713983&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=cakephp:environment&amp;rev=1739713983&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=cakephp:fontxxx&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=cakephp:jquery001&amp;rev=1739713983&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=cakephp:jquery002&amp;rev=1739713983&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=cakephp:jquery003&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=cakephp:mysql_replication&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=cakephp:naming&amp;rev=1739713983&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=cakephp:query_log&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=cakephp:row_number&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=cakephp:scaffold&amp;rev=1739713982&amp;do=diff"/>
                <rdf:li rdf:resource="https://shiyoka.com/doku.php?id=cakephp:validate_log&amp;rev=1739713983&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://shiyoka.com/lib/exe/fetch.php?media=wiki:dokuwiki.svg">
        <title>ClownWiki</title>
        <link>https://shiyoka.com/</link>
        <url>https://shiyoka.com/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
    </image>
    <item rdf:about="https://shiyoka.com/doku.php?id=cakephp:1.3x_pear&amp;rev=1739713983&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:03+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>1.3x_pear</title>
        <link>https://shiyoka.com/doku.php?id=cakephp:1.3x_pear&amp;rev=1739713983&amp;do=diff</link>
        <description>1.3x で pear

	*  Pear::Log
&lt;http://pear.php.net/package/Log&gt;

	*  CakePHP 1.3系 でPearを使う
/app/config/bootstrap.php に


App::build(array(&#039;pears&#039; =&gt; array(&#039;/usr/share/php&#039;)), true);


Pear を使用するところに


App::import(&#039;pear&#039;, &#039;TagCloud&#039;, array(&#039;file&#039; =&gt; &#039;HTML/TagCloud.php&#039;));</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=cakephp:environment&amp;rev=1739713983&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:03+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>environment</title>
        <link>https://shiyoka.com/doku.php?id=cakephp:environment&amp;rev=1739713983&amp;do=diff</link>
        <description>ダウンロードから初期設定まで

公式：&lt;http://cakephp.jp/&gt;
Book：&lt;http://book.cakephp.org/2.0/ja/index.html&gt;

ダウンロード

公式サイトのダウンロードサイト（github）からダウンロードする。


# wget https://github.com/cakephp/cakephp/archive/2.6.7.tar.gz


展開


# tar xzvf 2.6.7.tar.gz


設置

ドキュメントルートとcakeモジュールのディレクトリは別ける</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=cakephp:fontxxx&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>fontxxx</title>
        <link>https://shiyoka.com/doku.php?id=cakephp:fontxxx&amp;rev=1739713982&amp;do=diff</link>
        <description>文字化け対策

cakephp ＋ mysql（utf-8）で日本語を利用しようとすると文字化けが起こる。


SET NAMES utf8 


を実行すれば文字化けはなくなるのだが、それをcakephpで設定する方法。

以下のとおり、database.php に設定を追加すれば良い。</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=cakephp:jquery001&amp;rev=1739713983&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:03+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>jquery001</title>
        <link>https://shiyoka.com/doku.php?id=cakephp:jquery001&amp;rev=1739713983&amp;do=diff</link>
        <description>jQueryで非同期処理（DB更新）

テーブル作成


CREATE TABLE IF NOT EXISTS `tasks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created` datetime NOT NULL,
  PRIMARY KEY (`id`)
);</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=cakephp:jquery002&amp;rev=1739713983&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:03+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>jquery002</title>
        <link>https://shiyoka.com/doku.php?id=cakephp:jquery002&amp;rev=1739713983&amp;do=diff</link>
        <description>jQueryで非同期処理（DB更新） その2

protocalendar.js を組み込んでみる。
&lt;http://labs.spookies.jp/product/protocalendar&gt;

テーブル作成


CREATE TABLE IF NOT EXISTS `tasks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created` datetime NOT NULL,
  PRIMARY KEY (`id`)
);</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=cakephp:jquery003&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>jquery003</title>
        <link>https://shiyoka.com/doku.php?id=cakephp:jquery003&amp;rev=1739713982&amp;do=diff</link>
        <description>jQueryのアコーディオンメニュー

jQuery のダウンロード

	*  jQuery UI の公式サイト（&lt;http://jqueryui.com/&gt;）へアクセスする
	*  Download をクリックして Download Site（&lt;http://jqueryui.com/download&gt;）へ移動する
	*  右の黄色い網掛けの Version で 1.7.3 を選択する</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=cakephp:mysql_replication&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>mysql_replication</title>
        <link>https://shiyoka.com/doku.php?id=cakephp:mysql_replication&amp;rev=1739713982&amp;do=diff</link>
        <description>MySQLレプリケーション環境対応

動作概要

通常はスレーブに接続
↓
更新クエリ実行前にマスターに接続
↓
更新クエリ実行
↓
更新クエリ実行後、スレーブに接続を戻す
↓
通常スレーブに接続</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=cakephp:naming&amp;rev=1739713983&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:03+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>naming</title>
        <link>https://shiyoka.com/doku.php?id=cakephp:naming&amp;rev=1739713983&amp;do=diff</link>
        <description>命名規則やら

controller やら model やら DB やらを命名規則にしたがって命名

	*  CakePHP 規約ワードメーカー

	*  inflector.kaburk.com</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=cakephp:query_log&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>query_log</title>
        <link>https://shiyoka.com/doku.php?id=cakephp:query_log&amp;rev=1739713982&amp;do=diff</link>
        <description>クエリログ取得

cake/libs/model/datasources/dbo/dbo_mysql_log.phpを作成


&lt;?php

uses(&quot;model&quot;.DS.&quot;datasources&quot;.DS.&quot;dbo&quot;.DS.&quot;dbo_mysql&quot;);
class DboMysqlLog extends DboMysql{
   var $queryNo = 1;
   
   function execute($sql){
       $ret = parent::execute($sql);
       if(defined(&quot;LOG_SQL&quot;) &amp;&amp; LOG_SQL){
           $this-&gt;log(sprintf(&quot;%d.%s&quot;,$this-&gt;queryNo,$sql),SQL);
           $this-&gt;queryNo++;
       }
       return $ret;
   }
}</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=cakephp:row_number&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>row_number</title>
        <link>https://shiyoka.com/doku.php?id=cakephp:row_number&amp;rev=1739713982&amp;do=diff</link>
        <description>クエリ結果に自動采番

MySQL/oracleのrow_numberっぽい動き も参考

サンプルソース


public function test() {
   $sql = &quot;SET @r=0&quot;;
   $this-&gt;Ranking-&gt;query($sql);

   $sql = &quot;SELECT (@r:=@r+1) as row, id, name, (victory/games) as victory_rate, image_url, team_info_id
           FROM users
           WHERE games &gt; ?
           ORDER BY victory_rate DESC
           LIMIT ?&quot;;
   $val = $this-&gt;Ranking-&gt;query($sql, array(0, 100));

debug($val);
}</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=cakephp:scaffold&amp;rev=1739713982&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>scaffold</title>
        <link>https://shiyoka.com/doku.php?id=cakephp:scaffold&amp;rev=1739713982&amp;do=diff</link>
        <description>とりあえず画面作成

scaffold

テーブルとコントローラの作成だけでとりあえずCRUDができる。

テーブル作成


CREATE TABLE IF NOT EXISTS `users` (
 `id` int(11) NOT NULL AUTO_INCREMENT COMMENT &#039;ユーザーID&#039;,
 `name` varchar(64) NOT NULL COMMENT &#039;ユーザー名&#039;,
 `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT &#039;更新日時&#039;,
 `created` datetime NOT NULL COMMENT &#039;作成日時&#039;,
 PRIMARY KEY (`id`),
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;…</description>
    </item>
    <item rdf:about="https://shiyoka.com/doku.php?id=cakephp:validate_log&amp;rev=1739713983&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-16T13:53:03+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>validate_log</title>
        <link>https://shiyoka.com/doku.php?id=cakephp:validate_log&amp;rev=1739713983&amp;do=diff</link>
        <description>validateのログ出力

validate のエラー発生時の処理は

cake/cake/libs/model/mode.php

L2687


   function invalidate($field, $value = true) {
       if (!is_array($this-&gt;validationErrors)) {
           $this-&gt;validationErrors = array();
       }
       $this-&gt;validationErrors[$field] = $value;
   }</description>
    </item>
</rdf:RDF>
