<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cakephp.nu blog &#187; Cakephp</title>
	<atom:link href="http://www.cakephp.nu/c/cakephp/feed" rel="self" type="application/rss+xml" />
	<link>http://www.cakephp.nu</link>
	<description>Cake and cookies by Jippi</description>
	<lastBuildDate>Wed, 11 Aug 2010 09:15:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Generic non-www to www (and vice versa) 301 redirect using .htaccess</title>
		<link>http://www.cakephp.nu/quick-tip-generic-nonwww-www-vice-versa-301-redirect-htaccess</link>
		<comments>http://www.cakephp.nu/quick-tip-generic-nonwww-www-vice-versa-301-redirect-htaccess#comments</comments>
		<pubDate>Mon, 03 Nov 2008 15:33:06 +0000</pubDate>
		<dc:creator>Biesbjerg</dc:creator>
				<category><![CDATA[Cakephp]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[generic]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[redirect]]></category>

		<guid isPermaLink="false">http://www.cakephp.nu/?p=23</guid>
		<description><![CDATA[
The problem: I&#8217;ve always hardcoded the domain name in my htaccess&#8217;es, requiring me to make changes each time I deploy a new website. The solution: Behold, an alternate, generic method of redirecting non-www to www and www to non-www, requiring no changes between deployments! Non-www to www RewriteCond %{HTTP_HOST} !^www\. RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L] www [...]
]]></description>
			<content:encoded><![CDATA[<h2>The problem:</h2>
<p>I&#8217;ve always hardcoded the domain name in my htaccess&#8217;es, requiring me to make changes each time I deploy a new website.</p>
<h2>The solution:</h2>
<p>Behold, an alternate, generic method of redirecting non-www to www and www to non-www, requiring no changes between deployments!</p>
<h3>Non-www to www</h3>
<pre>RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]</pre>
<h3>www to non-www</h3>
<pre>RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^/(.*)$ http://%1/$1 [R=301,L]</pre>
<h3>Bonus tip: Remove trailing slash from address line</h3>
<p>RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]</p>

	Tags: <a href="http://www.cakephp.nu/t/301" title="301" rel="tag">301</a>, <a href="http://www.cakephp.nu/t/generic" title="generic" rel="tag">generic</a>, <a href="http://www.cakephp.nu/t/htaccess" title="htaccess" rel="tag">htaccess</a>, <a href="http://www.cakephp.nu/t/redirect" title="redirect" rel="tag">redirect</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.cakephp.nu/quick-tip-generic-nonwww-www-vice-versa-301-redirect-htaccess/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>A quick tutorial on CakePHP Set class (Part 1)</title>
		<link>http://www.cakephp.nu/quick-tutorial-cakephp-set-class-part-1</link>
		<comments>http://www.cakephp.nu/quick-tutorial-cakephp-set-class-part-1#comments</comments>
		<pubDate>Mon, 03 Mar 2008 23:56:36 +0000</pubDate>
		<dc:creator>Christian Winther</dc:creator>
				<category><![CDATA[Cakephp]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[set]]></category>

		<guid isPermaLink="false">http://www.cakephp.nu/quick-turtorial-cakephp-set-class-part-1</guid>
		<description><![CDATA[
Test data 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 $data = [...]
]]></description>
			<content:encoded><![CDATA[<h3>Test data</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
    <span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Post'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
            <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_comment_count'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> 
            <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My first title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'body'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My first body'</span> 
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
        <span style="color: #0000ff;">'PostComment'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
            <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
                <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'is_active'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> 
                <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My first comment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'body'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My first comment'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
            <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
                <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'is_active'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> 
                <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My second comment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'body'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My second comment'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
            <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
                <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'is_active'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> 
                <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My third comment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'body'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My third comment'</span><span style="color: #009900;">&#41;</span> 
        <span style="color: #009900;">&#41;</span> 
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
    <span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Post'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
            <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_comment_count'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> 
            <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My second title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'body'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My second title'</span> 
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
        <span style="color: #0000ff;">'PostComment'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
            <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
                <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'is_active'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> 
                <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My fourth comment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'body'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My fourth comment'</span> 
            <span style="color: #009900;">&#41;</span> 
        <span style="color: #009900;">&#41;</span> 
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
    <span style="color: #cc66cc;">3</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Post'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
            <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_comment_count'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> 
            <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My third title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'body'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My third title'</span> 
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
        <span style="color: #0000ff;">'PostComment'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>                   
&nbsp;
        <span style="color: #009900;">&#41;</span> 
    <span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                   
&nbsp;
<span style="color: #000088;">$dataExtra</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
    <span style="color: #cc66cc;">4</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Post'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
            <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_comment_count'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> 
            <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My fourth title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'body'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My fourth title'</span> 
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
        <span style="color: #0000ff;">'PostComment'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
            <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
                <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'is_active'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> 
                <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My fifth comment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'bdoy'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My fifth comment'</span> 
            <span style="color: #009900;">&#41;</span> 
        <span style="color: #009900;">&#41;</span> 
    <span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h3>Set::merge</h3>
<p><strong>PHP doc blcok</strong></p>
<pre>
This function can be thought of as a hybrid between PHP's array_merge and
array_merge_recursive. The difference to the two is that if an array key
contains another array then the function behaves recursive (unlike array_merge)
but does not do if for keys containing strings (unlike array_merge_recursive).
See the unit test for more information.         

Note: This function will work with an unlimited amount of arguments and
typecasts non-array parameters into arrays.</pre>
<p>A bit like <a target="_blank" href="http://php.net/array_merge_recursive">array_merge_recursive</a>. Merge joins two arrays on their keys.<br />
If we want to add the <strong>$extraData</strong> array into the <strong>$dat</strong> most people would probably think, hey, lets merge them using Set::merge&#8230; but.. no, dont, unless you know what your doing.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">pr<span style="color: #009900;">&#40;</span>Set<span style="color: #339933;">::</span><span style="color: #004000;">merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dataExtra</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>The above cod will only produce the &#8216;expected&#8217;(?) result because I have added the numeric key <strong>4</strong> in the $extraData array (Line 40). If I had, as I did the first time around, just let php auto-increment the keys for me, both $datad and $extraData would contain the numeric index key <strong>0</strong>, and since Set::merge works on keys, $extraData&#8217;s <strong>Fourth post</strong> would overwrite $data&#8217;s <strong>First post</strong> where they had anything in common (id, name, post_comment_count, body <strong>and</strong> everything in the first PostComment (My first comment)).</p>
<p>In case I had let php handle the index keys, I would have to use Set::insert to append the fourth comment to the list.</p>
<p>A better use of Set::merge is in CAKE/libs/model/model.php where is automagic merges &#8216;actsAs&#8217; from your current model (PostComment) and your AppModel, so you automagic inherit the global behaviors from AppModel:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// model.php </span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_subclass_of</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'AppModel'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
    <span style="color: #000088;">$appVars</span> <span style="color: #339933;">=</span> <span style="color: #990000;">get_class_vars</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'AppModel'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$merge</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>             
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>actsAs <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">null</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>actsAs <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        <span style="color: #000088;">$merge</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'actsAs'</span><span style="color: #339933;">;</span> 
    <span style="color: #009900;">&#125;</span>             
&nbsp;
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$merge</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$appVars</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$appVars</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #009900;">&#123;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #009900;">&#123;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span> Set<span style="color: #339933;">::</span><span style="color: #004000;">merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$appVars</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #009900;">&#123;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #009900;">&#125;</span> 
    <span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>A funny thing is that Set::merge is still rarely used in the core code yet. Probably because array_merge (or <strong>am()</strong>) is faster for simple operations like just merging two simple 1 level arrays like a config array.</p>
<h3>Set::filter</h3>
<p><strong>PHP doc blcok</strong></p>
<pre>Filters empty elements out of a route array, excluding '0'.</pre>
<p>This method is <strong>not</strong> recursive. So doing</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> ?php 
pr<span style="color: #009900;">&#40;</span>Set<span style="color: #339933;">::</span><span style="color: #004000;">filter</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>wont change anything in the array sinc no elements in first level is empty.</p>
<pre></pre>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">pr<span style="color: #009900;">&#40;</span>Set<span style="color: #339933;">::</span><span style="color: #004000;">filter</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>      
&nbsp;
<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Post'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
    <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> 
    <span style="color: #0000ff;">'post_comment_count'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> 
    <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My third title'</span><span style="color: #339933;">,</span> 
    <span style="color: #0000ff;">'body'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'My third title'</span> 
    <span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>We will notice that the PostComment array is gone, since its empty</p>
<h3>Set::pushDiff</h3>
<p><strong>PHP doc blcok</strong></p>
<pre>
Pushes the differences in $array2 onto the end of $array</pre>
<p>That sounds simple enough, and it really is.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">pr<span style="color: #009900;">&#40;</span>Set<span style="color: #339933;">::</span><span style="color: #004000;">pushDiff</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dataExtra</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>just pushes the $dataExtra on the end of $data, since they have nothing in common. Again, this method operates on the array keys when comparing arrays.</p>
<h3>Set::map</h3>
<p><strong>PHP doc block</strong></p>
<pre>
Maps the contents of the Set object to an object hierarchy.
Maintains numeric keys as arrays of objects</pre>
<p>That sounds very fancy, and it is! A lot of people migrating to CakePHP from Symfony (PHPDoctrine, Propel) will probably be confused at first that all model data in CakePHP is arrays, and not objects like other frameworks. This method attemps to &#8216;fix&#8217; this issue by converting a model data array to a set of objects (StdClass). StdClass is a build-in dummy class in PHP, and it doesnt really do anything but contain data, no methods or fancy magic there.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> ?php 
<span style="color: #666666; font-style: italic;">// Convert to objects </span>
<span style="color: #000088;">$map</span> <span style="color: #339933;">=</span> Set<span style="color: #339933;">::</span><span style="color: #004000;">map</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">// id of first post (Object style) </span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$map</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>id<span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">// name of first comment to first post (Object style) </span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$map</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>PostComment<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name<span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">// name of first comment to first post (array style) </span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$map</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PostComment'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// WONT WORK, Cannot access StdClass as an array</span></pre></td></tr></table></div>

<p>As you can see above, its important to decide what method you want to use, Object or Array style, since they cannot be mixed.<br />
Also, the return from Set::map is a mix of arrays and StdClass, thats why I can access $map[0] as array, but not access $map[0]['name'].</p>
<h3>Set::numeric</h3>
<p><strong>PHP doc blcok</strong></p>
<pre>
Checks to see if all the values in the array are numeric</pre>
<p>Not much to say on this one, because it doesnt do more or less than the name implies.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// false </span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span>Set<span style="color: #339933;">::</span><span style="color: #004000;">numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">// false </span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span>Set<span style="color: #339933;">::</span><span style="color: #004000;">numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">// false </span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span>Set<span style="color: #339933;">::</span><span style="color: #004000;">numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PostComment'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">// true </span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span>Set<span style="color: #339933;">::</span><span style="color: #004000;">numeric</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>&#8212;&#8212;-</p>
<p>Thats it for now, next time I will look at:</p>
<p>Set::enum, Set::format, Set::extract, Set::insert, Set::remove, Set::check, Set::diff, Set::isEqual, Set::contains, Set::countDim, Set::normalize, Set::combine and Set::reverse.</p>
<p>Look forward to it</p>

	Tags: <a href="http://www.cakephp.nu/t/cakephp" title="Cakephp" rel="tag">Cakephp</a>, <a href="http://www.cakephp.nu/t/english" title="english" rel="tag">english</a>, <a href="http://www.cakephp.nu/t/set" title="set" rel="tag">set</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.cakephp.nu/quick-tutorial-cakephp-set-class-part-1/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A small change in RSS feeds.</title>
		<link>http://www.cakephp.nu/small-change-rss-feeds</link>
		<comments>http://www.cakephp.nu/small-change-rss-feeds#comments</comments>
		<pubDate>Mon, 03 Mar 2008 22:52:56 +0000</pubDate>
		<dc:creator>Christian Winther</dc:creator>
				<category><![CDATA[Cakephp]]></category>
		<category><![CDATA[danish]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://www.cakephp.nu/small-change-rss-feeds</guid>
		<description><![CDATA[
Hello again. I have made a small change to the feeds now. Everybody who has subscribed by Feedburner should not notice anything strange. The reason for the change is that I want to be able to blog in Danish too once in a while, and to avoid the &#8216;danish pølsesnak&#8217; for you guys who does [...]
]]></description>
			<content:encoded><![CDATA[<p>Hello again.</p>
<p>I have made a small change to the feeds now. Everybody who has subscribed by Feedburner should not notice anything strange.</p>
<p>The reason for the change is that I want to be able to blog in Danish too once in a while, and to avoid the &#8216;danish pølsesnak&#8217; for you guys who does not understand Danish, I have moved the feed location to include only posts with the &#8216;english&#8217; tag in the future <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://feeds.feedburner.com/CakephpnuBlog">English posts only</a> (Hopefully your using this one right now <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ), <a href="http://feeds.feedburner.com/CakephpnuBlogDanish">Danish posts only</a> and <a href="http://feeds.feedburner.com/cakephp/all">Danish+English posts</a></p>
<p>/Jippi</p>

	Tags: <a href="http://www.cakephp.nu/t/danish" title="danish" rel="tag">danish</a>, <a href="http://www.cakephp.nu/t/english" title="english" rel="tag">english</a>, <a href="http://www.cakephp.nu/t/news" title="news" rel="tag">news</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.cakephp.nu/small-change-rss-feeds/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP talk from FOSDEM &#8211; Free and Open Source Software Developers&#8217; European Meeting</title>
		<link>http://www.cakephp.nu/cakephp-talk-fosdem-free-open-source-software-developers-european-meeting</link>
		<comments>http://www.cakephp.nu/cakephp-talk-fosdem-free-open-source-software-developers-european-meeting#comments</comments>
		<pubDate>Mon, 03 Mar 2008 21:43:13 +0000</pubDate>
		<dc:creator>Christian Winther</dc:creator>
				<category><![CDATA[Cakephp]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[fosdem]]></category>

		<guid isPermaLink="false">http://www.cakephp.nu/cakephp-talk-fosdem-free-open-source-software-developers-european-meeting</guid>
		<description><![CDATA[
A small note, gwoo&#8217;s talk from FOSDM 2008 has been made public avilable here together with his slides. Its actually a quite good presentation, too bad he ran out of time in the end Tags: Cakephp, english, fosdem
]]></description>
			<content:encoded><![CDATA[<p>A small note, gwoo&#8217;s talk from <a href="http://www.fosdem.org/">FOSDM 2008</a> has been made <a href="http://ftp.heanet.ie/mirrors/fosdem-video/2008/maintracks/FOSDEM2008-cakephp.ogg">public avilable here</a> together with <a href="http://cakephp.org/files/FOSDEM.pdf">his slides</a>.</p>
<p>Its actually a quite good presentation, too bad he ran out of time in the end <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>

	Tags: <a href="http://www.cakephp.nu/t/cakephp" title="Cakephp" rel="tag">Cakephp</a>, <a href="http://www.cakephp.nu/t/english" title="english" rel="tag">english</a>, <a href="http://www.cakephp.nu/t/fosdem" title="fosdem" rel="tag">fosdem</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.cakephp.nu/cakephp-talk-fosdem-free-open-source-software-developers-european-meeting/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CakePHP Weekly Summaries Issue #2</title>
		<link>http://www.cakephp.nu/cakephp-weekly-summaries-issue-2</link>
		<comments>http://www.cakephp.nu/cakephp-weekly-summaries-issue-2#comments</comments>
		<pubDate>Mon, 03 Mar 2008 21:37:43 +0000</pubDate>
		<dc:creator>Christian Winther</dc:creator>
				<category><![CDATA[Cakephp]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[weekly summaries]]></category>

		<guid isPermaLink="false">http://www.cakephp.nu/cakephp-weekly-summaries-issue-2</guid>
		<description><![CDATA[
Welcome Welcome to the second edition of the CakePHP weekly summaries. Its quite embarrassing that it had to take so long time to get the second editon out. Too long time has passed and the amount of things that has happend during that period is waaay too big to be covered here. Therefor I present [...]
]]></description>
			<content:encoded><![CDATA[<h3>Welcome</h3>
<p>Welcome to the second edition of the CakePHP weekly summaries.<br />
Its quite embarrassing that it had to take so long time to get the second editon out. Too long time has passed and the amount of things that has happend during that period is waaay too big to be covered here.<br />
Therefor I present this half-done 2nd edition of the weekly summaries, with a promise that every week from now on I will give you the latest and greatest from the CakePHP world.<br />
So with no further ado, please enjoy this old and probably rather outdated edition of the <del>weekly</del>monthly summaries. <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  See you at the 3rd edition soon <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Trac changes</h3>
<ul>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6321">Changeset #6321</a> (phpnut) Fixes <a title="Some non-executable files in source tree have executable permissions (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3817">Ticket #3817</a>, Some non-executable files in source tree have executable permissions
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6322">Changeset #6322</a> (phpnut) Updating controller tests created with the console. Added associated fixtures to model tests
</li>
<li><strong><a target="blank" href="http://trac.cakephp.org/changeset/6323">Changeset #6323</a></strong> (gwoo) Updating Cache to apply prefix for every key, closes <a title="Namespace Support for Cache (memcached) (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3821">Ticket #3821</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6324">Changeset #6324</a> (phpnut) Correcting links generated to additional app tests
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6325">Changeset #6325</a> (phpnut) Adding support for test fixture generation when creating models, this will eventually be moved to a task. Currently the $records are hard coded to create field type specific data, this will eventually be changed to create random data based on the field type. Refactored tests that are created for models, 3 working tests are not created when generating tests for the model. Added notice output to terminal when creating a project, the CAKE_CORE_INCLUDE_PATH is automatically altered and may need to be changed when moving to a production environment. &#8221;
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6326">Changeset #6326</a> (phpnut) Fixes svn file property line
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6327">Changeset #6327</a> (phpnut) Removing unneeded &#8216; : &#8216;
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6328">Changeset #6328</a> (phpnut) Removing unneeded &#8216; : &#8216;
</li>
<li><strong><a target="blank" href="http://trac.cakephp.org/changeset/6329">Changeset #6329</a></strong> (nate) Fixing reading and writing in Configure class for references 3 levels deep, fixes <a title="Configure doesnt read/write keys with more than two levels (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3845">Ticket #3845</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6330">Changeset #6330</a> (nate) Removing un-needed method from TimeHelper? test
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6331">Changeset #6331</a> (phpnut) Removing var $useTable; from generated model when tables follow conventions Fixed issue with model tests and fixtures not being created properly when Model name does not match table name
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6332">Changeset #6332</a> (phpnut) Updating controller tests created with the console. Added associated fixtures to model tests
</li>
<li><strong><a target="blank" href="http://trac.cakephp.org/changeset/6333">Changeset #6333</a></strong> (phpnut) Fixes <a title="Deprecated loadView() call in email component when using theme (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3849">Ticket #3849</a>, Deprecated loadView() call in email component when using theme
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6334">Changeset #6334</a> (gwoo) updating HttpSocket? with auth, closes <a title="HttpSocket auth doesn't work (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3838">Ticket #3838</a> removing type casting, fixes <a title="HttpSocket may improberly cast long numbers to ints, changing the value (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3827">Ticket #3827</a> adding socket.group to tests
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6335">Changeset #6335</a> (gwoo) updating component, removing use of Router not needed anymore, fixes <a title="Fatal error: Class 'Router' not found (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3858">Ticket #3858</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6336">Changeset #6336</a> (nate) Adding non-null association key fix in Model, and updating Model::isUnique() to account for current record, fixes [ticket fixed 38599, closes [ticket fixed #2032]
</li>
<li><strong><a target="blank" href="http://trac.cakephp.org/changeset/6337">Changeset #6337</a></strong> (nate) Fixing return value in Model::saveAll(), fixes <a title="saveAll() Reporting Incorrect Result (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3852">Ticket #3852</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6338">Changeset #6338</a> (phpnut) Fixes <a title="Scaffolding and bake script has problems with tables that has underscore in it's name. (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3829">Ticket #3829</a>, Scaffolding and bake script has problems with tables that has underscore in it&#8217;s name
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6339">Changeset #6339</a> (phpnut) Fixes <a title="custom scaffolding file lookup paths inconsistent (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3798">Ticket #3798</a>, custom scaffolding file lookup paths inconsistent
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6340">Changeset #6340</a> (phpnut) Fixes <a title="set_time_limit(0) has no effect because of ini_set('max_execution_time', 60 * 5); (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3862">Ticket #3862</a>, set_time_limit(0) has no effect because of ini_set(&#8216;max_execution_time&#8217;, 60 * 5); changed max_execution_time , 0. Since php 4.3 this is the default anyway
</li>
<li><strong><a target="blank" href="http://trac.cakephp.org/changeset/6341">Changeset #6341</a></strong> (phpnut) Fixes <a title="$_SESSION not found (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3811">Ticket #3811</a>, $_SESSION not found Fixes [ticked fixed 3823], Session not restarted after instantiating new SessionComponent? Fixes #3850, Configuration Session.start and SessionComponent::__active aren&#8217;t handle correctly
</li>
<li><strong><a target="blank" href="http://trac.cakephp.org/changeset/6342">Changeset #6342</a></strong> (phpnut) Fixes <a title="Acl component fails to check() if a permission is denied in action (*) (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3851">Ticket #3851</a>, Acl component fails to check() if a permission is denied in action (*)
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6343">Changeset #6343</a> (phpnut) Adding test cases from [ticked closed 3810]
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6344">Changeset #6344</a> (phpnut) Reverting [] and [] this commit broke the working implementation. Closes <a title="__doThread function of model_php5/model_php4 is broken (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3810">Ticket #3810</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6345">Changeset #6345</a> (phpnut) Fixes <a title="Scaffolding is generating an id field with an empty value for auto_increment primary key (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3854">Ticket #3854</a>, Scaffolding is generating an id field with an empty value for auto_increment primary key
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6346">Changeset #6346</a> (phpnut) Fixing bug with scaffold and valid Session id check
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6347">Changeset #6347</a> (phpnut) Fixing bug with scaffold and valid Session id check in 1.1.x.x
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6348">Changeset #6348</a> (gwoo) updating View error handling for extensions, fixes <a title="Can't change extension of layout file (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3795">Ticket #3795</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6349">Changeset #6349</a> (nate) Correcting parameter declaration in API shell
</li>
<li><strong><a target="blank" href="http://trac.cakephp.org/changeset/6350">Changeset #6350</a></strong> (nate) Fixing database drivers for UPDATE/DELETE changes, updating drivers to comply with model tests, most passing. Fixes <a title="DB support for Aliases in genereted UPDATE SQL (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3794">Ticket #3794</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6351">Changeset #6351</a> (nate) Whitespace fixes
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6352">Changeset #6352</a> (gwoo) adding connection param to schema shell
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6353">Changeset #6353</a> (nate) Enabling alternate titles for PaginatorHelper::sort() links based on sort direction, closes <a title="Introduce different titles for Paginator::sort() depending on direction (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3865">Ticket #3865</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6354">Changeset #6354</a> (nate) Removing MySQL-specific schema code from core, improving support for PostgreSQL sequences, most tests passing
</li>
</ul>
<h3>Google group topics</h3>
<h4>Why doesn&#39;t Find* return a group of model objects?</h4>
<p>This topic has been discussed <strong>many</strong> times before, but Deane felt that it was required to ask yet again: &#8220;<a title="Google group: Why doesn&#39;t Find* return a group of model objects?" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/77794ca01fa52f9f">Why doesn&#39;t Find* return a group of model objects?</a>&#8220;. He wanted to be able to work with his models in the view (!BAD DESIGN!), and was confused why he only got an array back from the find* methods. Gwoo replied, and I quote: &#8220;<strong>Speed, simplicity, clarity</strong>&#8221; and pointed out that Cake provide view helpers to work with the arrays in almost any way you can imagine, and that the models provide callback functions (afterFind, afterSave, beforeFind, beforeFind) to format your data.<br />
Deane thanked gwoo for the reply, but &#8220;We couldn&#8217;t disagree more strenuously, and we think you&#8217;re wrong beyond belief in your reasoning, but we appreciate the response&#8221;&#8230;. didnt like gwoo&#8217;s reply at all.<br />
Gwoo replied in a calmly matter that &#8220;Everyone is entitled to their opinion and their choice of frameworks.&#8221;<br />
rtconner joined the discussion, offering a solution based on some old code by gwoo that would enable the <a href="http://bin.cakephp.org/saved/24245">models to return objects</a> (StdClass, not models classes)instead of arrays.<br />
Nick also joined the thread, backing up Deaen&#8217;s point of view (Cake is wrong, symfony lover is right) that its proper OO to use objects instead of arrays for the view data, but also reasoned that cake does indeed have the needed hooks and concepts to achieve Deane&#8217;s initial idea with a minimal effort. He explained that in a project he had created with CakePHP was that relationships (belongsTo, hasMany ect.) get more complicated with the OO styled approach, since the queries often fetched much more data than was really needed in the view. The combination of the controller didnt know wich fields the view required and the complex relation ships was in his opinion, not ideal at all. Their work a round was to create a &#8220;LazyData&#8221; class to handle it.<br />
Robby Anderson dropped in his 2 cents, and agreed that the cake was isnt 100% pure OO, but that the concept of &#8220;having the view incapable of performing any meaningful business logic&#8221; is bad, and will sooner or later lead to an unmanagelbe code base.<br />
Deane, the creater of the thread, posted a public apoligy to gwoo, explaining that he was fustrated at the time when he posted his previous post.</p>
<p>So, the summary must be that while some people dont like the design decission that CakePHP models return arrays instead of objects, others agree that its the right way to encapsulate the buisness logic in a correct Model View Control manner, and if you want to break theese convensions, its rather easy to do with minimal effort.</p>
<h4>Passing Data To A Form</h4>
<p>Travis asked how you are <a title="Google group: Passing Data To A Form" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/92d9341a3bf14699">Passing Data To A Form</a>. A bit unexpted (or perhaps expected given the flood of duplicate / newbie questions hitting the groups daily) nobody answered his question. The answer is pretty simple, and covered in any tutorial aviable on cakephp website AND in the documenation / manual.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> update<span style="color: #009900;">&#40;</span><span style="color: #000088;">$employeeID</span><span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#123;</span> 
     <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>data <span style="color: #339933;">=</span>  <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>Employee<span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>findAllById<span style="color: #009900;">&#40;</span><span style="color: #000088;">$employeeID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h4>The Show Is Back!</h4>
<p>Jeff Loiselle aka phishy announced that <a target="_blank" href="http://live.cakephp.org">the show is back</a>. No replies, no thing, its sad&#8230; the show rocks !</p>
<h4>I18n in 1.2 model validation message</h4>
<p>Athies asked how does <a title="Google group: i18n in 1.2 model validation message" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/6ac5b6520c7e39df">i18n in 1.2 model validation message</a> work. His iniital attemp was to use the i18n method &#8216;__()&#8217; in the model $validate array, but he was getting syntax errors when doing that.<br />
Since PHP does not support useage of functions in instance delclarations its not possible to use i18n directly in the validate array.<br />
Francky06l pointed at his solution in another google post <a title="Google group: i18n: static language references with __(&quot;My lang key&quot;, true) in models and controllers" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/fa32c81acc043eef">i18n: static language references with __(&quot;My lang key&quot;, true) in models and controllers</a>, and while the solution will work, its far from ideal when working with i18n.<br />
A CakePHP google group regular, Dr. Tarique Sani, pointed out that the correct way to handle i18n validation messages was in the view, not at the model level. Amit Badkas backed up Tarique up and provided a simple example on how to do it:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> ?php <span style="color: #b1b100;">echo</span> 
<span style="color: #000088;">$form</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>input<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
    <span style="color: #0000ff;">'alphanumeric'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Username must contain alpha-numeric characters'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
    <span style="color: #0000ff;">'between'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Username must be between 8 to 20 characters'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
?<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Francky06l seemed to know that, his consern was the if he multiple views where the validation errors should show, it would be convenient to do it at model level.<br />
Robby Anderson wasnt sure why you just couldnt do both, create the validation errors in the model, and wrap them in __() in the view.</p>
<p>And sure, that will work &#8211; but &#8211; you will loose some cake magic with that. The console application</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">cake i18n <span style="color: #990000;">extract</span></pre></div></div>

<p>will not add the i18n messages to the pot file automagic. Also, the i18n extract command will not even search your models for any i18n magic. It will only look in controllers and views. You can choose to call this a limit or a feature, but thats how cakephp has decided to do it, to enforce their paradime on how an application should be build and structured.</p>
<h4>FormHelper Labels</h4>
<p>Travis asked how it was possible to disable the automagic label in the FormHelper. Robby Anderson provided the correct solution for this issue, use &#8216;label&#8217; =&gt; <strong>false</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> ?php <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>input<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Employee.name'</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>?<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span></pre></div></div>

<h4>Using model objects in the controllers</h4>
<p><a href="#Why_doesn.26.2339.3Bt_Find.2A_return_a_group_of_model_objects.3F">Deane from earlier</a> posted another question on <a title="Google group: Using model objects in the controllers" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/3d03fd90d7fabaea">Using model objects in the controllers</a>. I dont really want to dwell much on this post, since its really attemp to take CakePHP in another direction than its supposed to. Deane clearly shows a lack of insight on how cakephp is supposed to work, and failed to provide any usefull examples that could show the group what he wanted to do.</p>

	Tags: <a href="http://www.cakephp.nu/t/cakephp" title="Cakephp" rel="tag">Cakephp</a>, <a href="http://www.cakephp.nu/t/english" title="english" rel="tag">english</a>, <a href="http://www.cakephp.nu/t/weekly-summaries" title="weekly summaries" rel="tag">weekly summaries</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.cakephp.nu/cakephp-weekly-summaries-issue-2/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CakePHP Weekly Summaries Issue #1.5</title>
		<link>http://www.cakephp.nu/cakephp-weekly-summaries-issue-15</link>
		<comments>http://www.cakephp.nu/cakephp-weekly-summaries-issue-15#comments</comments>
		<pubDate>Mon, 21 Jan 2008 20:22:34 +0000</pubDate>
		<dc:creator>Christian Winther</dc:creator>
				<category><![CDATA[Cakephp]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[weekly summaries]]></category>

		<guid isPermaLink="false">http://www.cakephp.nu/cakephp-weekly-summaries-issue-15</guid>
		<description><![CDATA[
Hello, just wanted to post a quick apoligy Sorry that I havent created the weekly summaries for almost 1.5 week now. The reason is that I have begun on a new job, and its consuming quick alot of time and energy Lot of new systems to learn (They dont use Cake&#8230;. yet, booooh!) I have [...]
]]></description>
			<content:encoded><![CDATA[<p>Hello,<br />
just wanted to post a quick apoligy <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Sorry that I havent created the weekly summaries for almost 1.5 week now. The reason is that I have begun on a new job, and its consuming quick alot of time and energy <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Lot of new systems to learn (They dont use Cake&#8230;. yet, booooh!) </p>
<p>I have the second edition 80% done, just need to clean it up and proof read it a few times <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Should be done before this weekend</p>

	Tags: <a href="http://www.cakephp.nu/t/cakephp" title="Cakephp" rel="tag">Cakephp</a>, <a href="http://www.cakephp.nu/t/english" title="english" rel="tag">english</a>, <a href="http://www.cakephp.nu/t/weekly-summaries" title="weekly summaries" rel="tag">weekly summaries</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.cakephp.nu/cakephp-weekly-summaries-issue-15/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>CounterCache in CakePHP 1.2 beta</title>
		<link>http://www.cakephp.nu/countercache-cakephp-12-beta</link>
		<comments>http://www.cakephp.nu/countercache-cakephp-12-beta#comments</comments>
		<pubDate>Fri, 04 Jan 2008 23:32:54 +0000</pubDate>
		<dc:creator>Christian Winther</dc:creator>
				<category><![CDATA[Cakephp]]></category>
		<category><![CDATA[counter cache]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.cakephp.nu/countercache-cakephp-12-beta</guid>
		<description><![CDATA[
Update 05.01.2008 At the moment the counterCache code is only executed on CREATE, not on UPDATE &#8211; a patch is under way Hello, Just a little turtorial to demonstrate the new model counterCache feature. CounterCache is a very fancy little addition to our beloved CakePHP framework. Simply put, all it does is make sure that [...]
]]></description>
			<content:encoded><![CDATA[<p><strong>Update</strong><br />
<em>05.01.2008</em> At the moment the counterCache code is only executed on CREATE, not on UPDATE &#8211; a patch is under way</p>
<p>Hello,</p>
<p>Just a little turtorial to demonstrate the new model counterCache feature.</p>
<p>CounterCache is a very fancy little addition to our beloved CakePHP framework.<br />
Simply put, all it does is make sure that your belongsTo associations always have an updated field with the count of elements belonging to the parent.</p>
<p>Lets use this simple example, just two models and controllers:</p>
<ul>
<li>Posts (posts_controller) (hasMany PostComment)
</li>
<li>PostComments (post_comments_controller) (belongsTo Post)
</li>
</ul>
<h3>SQL</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- our posts </span>
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`posts`</span> <span style="color: #66cc66;">&#40;</span> 
  <span style="color: #ff0000;">`id`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span> 
  <span style="color: #ff0000;">`post_comment_count`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span> 
  <span style="color: #ff0000;">`title`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span> 
  <span style="color: #ff0000;">`body`</span> text <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span> 
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span> 
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>utf8 ROW_FORMAT<span style="color: #66cc66;">=</span>DYNAMIC;             
&nbsp;
<span style="color: #808080; font-style: italic;">-- comments to our post </span>
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`post_comments`</span> <span style="color: #66cc66;">&#40;</span> 
  <span style="color: #ff0000;">`id`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span> 
  <span style="color: #ff0000;">`post_id`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span> 
  <span style="color: #ff0000;">`is_active`</span> tinyint<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'0'</span><span style="color: #66cc66;">,</span> 
  <span style="color: #ff0000;">`name`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span> 
  <span style="color: #ff0000;">`body`</span> text <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span> 
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> 
  <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #ff0000;">`post_id`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`post_id`</span><span style="color: #66cc66;">&#41;</span> 
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>utf8 ROW_FORMAT<span style="color: #66cc66;">=</span>DYNAMIC;</pre></td></tr></table></div>

<p>To keep things simple, we are just going to use scaffolding in controllers.</p>
<h3>Controllers</h3>
<h4>Posts controller</h4>
<p>Put in APP/controllers/posts_controller.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>?php 
<span style="color: #666666; font-style: italic;">// Posts controller </span>
<span style="color: #000000; font-weight: bold;">class</span> PostsController <span style="color: #000000; font-weight: bold;">extends</span> AppController <span style="color: #009900;">&#123;</span> 
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$scaffold</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h4>PostComments controller</h4>
<p>Put in APP/controllers/post_comments_controller.php</p>
<pre></pre>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>?php 
<span style="color: #666666; font-style: italic;">// Post comments controller </span>
<span style="color: #000000; font-weight: bold;">class</span> PostCommentsController <span style="color: #000000; font-weight: bold;">extends</span> AppController <span style="color: #009900;">&#123;</span> 
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$scaffold</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h3>Models</h3>
<h4>Post model</h4>
<p>Put in APP/models/post.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>?php 
<span style="color: #000000; font-weight: bold;">class</span> Post <span style="color: #000000; font-weight: bold;">extends</span> AppModel <span style="color: #009900;">&#123;</span> 
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$hasMany</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'PostComment'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h4>PostComment model</h4>
<p>Put in APP/models/post_comment.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>?php 
<span style="color: #000000; font-weight: bold;">class</span> PostComment <span style="color: #000000; font-weight: bold;">extends</span> AppModel <span style="color: #009900;">&#123;</span> 
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$belongsTo</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Post'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'counterCache'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>The interesting thing is the above <strong>PostComment</strong> model. A you can see, a new options key is added, <strong>counterCache</strong> and is set to <u>(bool) true</u>. This informs cake that it should use counterCache on the class (Post) it belongs to.<br />
This is three possible variables to assign <strong>counterCache</strong></p>
<ul>
<li><strong>(bool) true</strong> means enabled, and that cake should auto-generate the count field automagic
</li>
<li><strong>(string) fieldname</strong> tells cake to use your custom field in Post (posts) model and table.
</li>
<li><strong>any value that is considered &#8216;empty&#8217;</strong>disable the feature (this is default, NULL)
</li>
</ul>
<p>Its important to understand, that the field we specify here, is a field in the REMOTE model / table, not in the local table, so in this case, the field name is in <strong>posts</strong> table.!</p>
<p>As said earlier, cake will automagic generate the remote field name if you only provide a boolean true value, in this case the field will be named <strong>Inflector::underscore($this-&gt;alias) . &#8216;_count&#8217;</strong> &#8211; meaning the alias of the <strong>LOCAL</strong> model (PostComment) and a suffix &#8216;_count&#8217;. All is that is converted to a lowercase, underscored value. When these rules are applied to our example above, the remote field in posts will be named <strong>post_comment_count</strong> (line 4 in SQL section)</p>
<p>With the code above, you have a very basic scaffolding setup running with couterCache enabled. Very simple stuff <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  As always when its from the CakePHP team.</p>
<h3>Using counterCache scope</h3>
<p>As you might have noticed in the SQL table above, the post_comments table have a field called <strong>is_active</strong> (SQL line 14). This is a sample on how you could moderate your comments. Lets change a bit of code in our models to make this work.</p>
<p>Put in APP/models/post.php (Updated)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>?php 
<span style="color: #666666; font-style: italic;">// Updated Post model </span>
<span style="color: #000000; font-weight: bold;">class</span> Post <span style="color: #000000; font-weight: bold;">extends</span> AppModel <span style="color: #009900;">&#123;</span> 
<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$hasMany</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'PostComment'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
        <span style="color: #0000ff;">'conditions'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'is_active'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> 
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Notice that I have added a <strong>conditions</strong> array to the <strong>hasMany</strong> relation to <strong>PostComment</strong>.<br />
This will tell cake to only fetch comments from PostComment where is_active is 1 (aka. is active).</p>
<p>Put in APP/models/post_comment.php (Updated)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>?php 
<span style="color: #000000; font-weight: bold;">class</span> PostComment <span style="color: #000000; font-weight: bold;">extends</span> AppModel <span style="color: #009900;">&#123;</span> 
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$belongsTo</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Post'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
        <span style="color: #0000ff;">'counterCache'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> 
        <span style="color: #0000ff;">'counterScope'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'is_active'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> 
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Notice that I have added another field to the <strong>Post</strong> relation called <strong>counterScope</strong>, this is the conditions that cake uses in the <strong>find(&#8216;count&#8217;)</strong>query it creates to find the amount of comments to the Post. By adding this simple array, our counterCache now only count active comments <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Easy done</p>

	Tags: <a href="http://www.cakephp.nu/t/cakephp" title="Cakephp" rel="tag">Cakephp</a>, <a href="http://www.cakephp.nu/t/counter-cache" title="counter cache" rel="tag">counter cache</a>, <a href="http://www.cakephp.nu/t/english" title="english" rel="tag">english</a>, <a href="http://www.cakephp.nu/t/tutorials" title="tutorials" rel="tag">tutorials</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.cakephp.nu/countercache-cakephp-12-beta/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>CakePHP Weekly Summaries Issue #1</title>
		<link>http://www.cakephp.nu/cakephp-weekly-summaries-issue-1</link>
		<comments>http://www.cakephp.nu/cakephp-weekly-summaries-issue-1#comments</comments>
		<pubDate>Fri, 04 Jan 2008 21:23:18 +0000</pubDate>
		<dc:creator>Christian Winther</dc:creator>
				<category><![CDATA[Cakephp]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[weekly summaries]]></category>

		<guid isPermaLink="false">http://www.cakephp.nu/cakephp-weekly-summaries-issue-1</guid>
		<description><![CDATA[
Welcome to the first issue of CakePHP Weekly Summary. Below you&#8217;ll find all sorts of interesting topics that were discussed on the CakePHP mailing list and on SVN. This week alot happened, but the biggest news is that CakePHP 1.2 have entered BETA phase, and with that &#8211; we are close to a feature (API) freeze of the [...]
]]></description>
			<content:encoded><![CDATA[<p>Welcome to the first issue of CakePHP Weekly Summary. Below you&#8217;ll find all sorts of interesting topics that were discussed on the CakePHP mailing list and on <a target="_blank" href="http://trac.cakephp.org/timeline">SVN</a>.</p>
<p>This week alot happened, but the biggest news is that CakePHP 1.2 have entered <strong>BETA</strong> phase, and with that &#8211; we are close to a feature (API) freeze of the 1.2 branch.</p>
<p align="center">•••••••••••••••••••••••••••••••••••••••••••••••••••••••</p>
<h3>CakePHP 1.2 beta</h3>
<p>Yes, finally it happened. Please look at my post about the <!--intlink id="4" text="release of CakePHP 1.2 beta"-->.</p>
<h3>Trac changes</h3>
<ul>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6288">Changeset #6288</a> (gwoo) Added support for stored procedues in DboMysqli, fixes <a title="Passing null to Session-&gt;setFlash() params causes error. (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/2340">Ticket #2340</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6289">Changeset #6289</a> (gwoo) Updating controller task with i18n wrappers, closes <a title="i18n-friendly flash messages in baked controller. (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3490">Ticket #3490</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6290">Changeset #6290</a> (nate) Updating help text for ACL shell interface, fixes <a title="acl help grant: use of aco_id, aro_id is confusing (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3790">Ticket #3790</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6291">Changeset #6291</a> (phpnut) Moved merging of components, helpers, and uses vars to Controller::_mergeVars(); fixes bug with PluginAppController? vars not being merged before components are loaded. Fixed <a title="BindableBehaviour - Essential functionality (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3760">Ticket #3760</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6292">Changeset #6292</a> (phpnut) Missing keys when Model merges actsAs. Fixed <a title="[Patch] Missing keys when Model merges actsAs (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3786">Ticket #3786</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6293">Changeset #6293</a> (nate) Adding quoting and name-resolving fields in TreeBehavior. Fixed <a title="Tree behavior SQL bug (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3778">Ticket #3778</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6295">Changeset #6295</a> A few new exciting features was pushed into the repository:
<ul>
<li><!--intlink id="8" text="CounterCache (view my article on counterCache)"-->
</li>
<li>Model::generateList() was deprecated, and replaced by the new 1.2 cake find syntac. Model::find(&#8216;list&#8217;)
</li>
<li>Model::saveAll() was enhanced to save multiple records and associated records
</li>
<li>Some transactional methods (begin, commit, rollback) was added to DataSource class as well
</li>
<li>bindModel now support to change the bind settings on the fly if the model has already been bound
</li>
<li>Fixed <a title="A bug about magic fields in $whitelist (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3720">Ticket #3720</a>, <a title="bindModel (or similar) to modify existing model binding options, rather than replacing entirely (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/2355">Ticket #2355</a>, <a title="Save associated models along with the model. (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3615">Ticket #3615</a>
</li>
</ul>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6296">Changeset #6296</a> Implemented Validation::extension(); and Vaidation::range(); Fixed <a title="Built-in file validation (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/2897">Ticket #2897</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6297">Changeset #6297</a> Some optimization in code. Fixed <a title="Some optimization in code (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3653">Ticket #3653</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6298">Changeset #6298</a> Adding test for root path caching. Fixed <a title="View Caching and Routing (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/1349">Ticket #1349</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6299">Changeset #6299</a> Adding full join model support. Fixed <a title="Storing additional data on join tables (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/828">Ticket #828</a>, <a title="HTML ID property for controller's dump DIV (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/1045">Ticket #1045</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6300">Changeset #6300</a> Adding Debugger::log and test cases. Fixed [ticket tixed 995]
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6301">Changeset #6301</a> CSRF usability problems, Security Component and multiple instances of the webapp. Fixed <a title="CSRF usability problems (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/2608">Ticket #2608</a>, <a title="Scurity Compontent and multiple instances of the webapp (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3436">Ticket #3436</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6302">Changeset #6302</a> Adding new URL to validation test
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6303">Changeset #6303</a> Renaming domains in test to generic names
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6304">Changeset #6304</a> Fixing Model::find(&#8216;list&#8217;) when using self-joins
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6306">Changeset #6306</a> Refactoring, fixing SessionComponent test, adding String::tokenize()
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6307">Changeset #6307</a> Adding regular expression support to Set::extract() [ Set::map($data, '{s}.{n}.{[0-9]} ]. Fixed <a title="[Patch][Test] Set::extract enhancements (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3263">Ticket #3263</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6308">Changeset #6308</a> Fixing paths returned by Debugger::trimPath();
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6309">Changeset #6309</a> Fixing paths in debugger tests
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6310">Changeset #6310</a> Fixing paths in debugger tests
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6312">Changeset #6312</a> Adding String class to shell boostrap. Fixed <a title="Set::extract missing String object (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3793">Ticket #3793</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6313">Changeset #6313</a> Fixing JavascriptHelper::link() for script files outside of webroot/js (i.e. plugins). Fixed <a title="$javascript-&gt;link() incorrectly formatting paths for plugin vendors files (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3799">Ticket #3799</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6314">Changeset #6314</a> Removing unused directories from app/pages. Merging changes from app/ to skel/
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6315">Changeset #6315</a> Fixing after filters for Model::find(&#8216;list&#8217;). Fixed <a title="model-&gt;find('list', ...) does not work with i18n (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3805">Ticket #3805</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6316">Changeset #6316</a> Updating TimeHelper. Fixed <a title="TimeHelper has undefined variable (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3801">Ticket #3801</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6317">Changeset #6317</a> Bug in hasAndBelongsToMany. Fixed <a title="Bug in hasAndBelongsToMany (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3814">Ticket #3814</a>
</li>
<li><a target="blank" href="http://trac.cakephp.org/changeset/6320">Changeset #6320</a> updating Set::map() handling of deeply nested arrays, thanks to speedmax for an updated test case. Fixed <a title="Set::__map() mapping nested array in a unexpected way. (closed and fixed)" style="color: green" target="blank" href="https://trac.cakephp.org/ticket/3809">Ticket #3809</a>
</li>
</ul>
<h3>Google group topics</h3>
<h4>How to find referrer url?</h4>
<p>A guy called &#8216;krr&#8217; opened a question <a title="Google group: how to find referrer url?" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/25c4f95a44bc00db">how to find referrer url?</a>, and Daniel Hofstetter quickly replied that Controller::referer() would return the referer.</p>
<h4>Will CakePHP be able to survive as the Zend Framework matures?</h4>
<p>The framework war ignited yet again when &#8220;Action&#8221; created <a title="Google group: Will CakePHP be able to survive as the Zend Framework matures?" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/15d5a0b5a4a312b8">Will CakePHP be able to survive as the Zend Framework matures?</a>.</p>
<h4>Upgrade problems</h4>
<p>Following the release of 1.2 beta &#8220;Mech7&#8243; <a title="Google group: Upgrade problems" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/c6d34dc297233424">Upgrade problems</a> after upgrading his application to the new beta verion. Chris Hartjes quite replied that Mech7 should check his apache and php error logs. Mech7 however, quickly replied that the error was solved (after only 9 minutes), and his solution was to clear the app/tmp/cache folder in this app.<br />
I had however already written a list of steps I follow when my application suffers from the White Screen Of Death:</p>
<ul>
<li>Check that debug &gt; 0
</li>
<li>Clear app/tmp/cache/persistent/*
</li>
<li>Check local vhost error log
</li>
<li>Check global httpd-error log
</li>
<li>Restart apache, (stop, start), restart cache services (memcached ect.)
</li>
<li>Enter the world of die(&#8216;stop&#8217;); from app/webroot/index.php and downward in your application
</li>
</ul>
<h4>Table inheritance, multiple schemas, and associations</h4>
<p>Brian had a interesting question, well, for us postgresql users at least, <a title="Google group: table inheritance, multiple schemas, and associations" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/4f3fcad44af52cb2">table inheritance, multiple schemas, and associations</a>. There we no response to this thread, but after a few hours, he returned with a working solution, very interesting stuff. <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h4>Depricated ListControllers</h4>
<p>Ronald Chaplin asked what the &#8216;new&#8217; way was in 1.2 to get a list of controllers in your application, since 1.2 had <a title="Google group: Depricated ListControllers" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/a51351910a6b3eed">Depricated ListControllers</a> ( listClasses( CONTROLLERS ); ). He had tried Configure::listObjects(&#8216;controller&#8217;, &#8216;/app/controller&#8217;);, but without success.<br />
Arno Esterhuizen quickly pointed Ronald in the right direction, <a href="http://api.cakephp.org/1.2/class_configure.html#a031c880ff156d79b6402327cda04330">the CakePHP 1.2 api</a></p>
<h4>OthAuth looses session &#8211; upgrading to new 1.2.0.6311 (2008)</h4>
<p>Klaus had a problem, <a title="Google group: othAuth looses session - upgrading to new 1.2.0.6311 (2008)" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/e45060caa0af039f">othAuth looses session &#8211; upgrading to new 1.2.0.6311 (2008)</a>, but so far no replies, might be a local issue on his setup?</p>
<h4>Themes management for an app ?</h4>
<p>Max asked if anyone had a component/helper for <a title="Google group: Themes management for an app ?" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/9514a0ce300fdb3">Themes management for an app ?</a>. Tarique shamelessly pointed to his own blog, where there is <a target="_blank" href="http://www.sanisoft.com/blog/2007/12/29/theming-your-cakephp-apps-v12/">quick guide on how to make cakephp use ThemeView</a>.</p>
<h4>Cakephp with PHP 5 and Mysql 5</h4>
<p>One of the too often asked questions on the group was asked yet again, <a title="Google group: Cakephp with PHP 5 and Mysql 5" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/4b3dc455f326210a">Cakephp with PHP 5 and Mysql 5</a>, and yes. <strong>CakePHP works fine with both MySQL5 and PHP5!!</strong>. Its rather funny, or sad depending on who you are, that the same questions is asked over and over on the <strong>google</strong>groups&#8230;. I&#8217;m sure the CakePHP guys chose google for a reason <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h4>Bug for find(&#39;All&#39;</h4>
<p>Another of repeating posts on the mailing list is the &#8220;I think I have found a bug&#8221; or just <a title="Google group: bug for find(&#39;All&#39;" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/21dabf1a2c6c3a25">bug for find(&#39;All&#39;</a> in this case. And as always, people always point directly to <a target="_blank" href="https://trac.cakephp.org/">Trac bugtracket</a>, as its the one and only place to submit possible bugs..</p>
<h4>CakeFest website Launched</h4>
<p>Mariano Iglesias announced that the <a title="Google group: CakeFest website Launched" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/9c4eff22ea10190d">CakeFest website Launched</a>! There was no replies or reactions on the list, I just hope that people did not overlook this little gem <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h4>Bakery hates me</h4>
<p>Adam Royle claimed that &#8220;<a title="Google group: bakery hates me" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/6fc38a1062e033a3">bakery hates me</a>&#8220;, because he was not able to comment on a bakery article. Mariano Iglesias was quick to point to <a target="_blank" href="http://trac.cakephp.org">trac</a>website, but a Dr. Hannibal Lecter was snappy, and said &#8220;I don&#8217;t think posting links to Trac solves anything, it is a fact that bakery has many issues (some minor and some..not so minor). Some things should be seriously reconsidered and rewritten. But that&#8217;s just my 2c.&#8221;.</p>
<p>As much as Chris Hartjes agreed with Dr. Hannibal Lecter, he pointed out the important fact that trac is still the one and only place for bugs on cakephp related projects.<br />
Dr. Hannibal Lecter hoped that someone from the core team was following the group, since it wouldn&#8217;t be very (And I quote) &#8220;userfriendly community&#8221; if they didnt.<br />
Dr. Tarique Sani (Whats up with all those doctors?) replied that it was unfair against the php team to mark the community less userfriendly because users finding bugs wouldn&#8217;t bother to create tickets on trac, and just posting the errors on the mailing list.<br />
And FWIW my personal experience is that posting in trac works</p>
<p>Adam Royle said that the reason why he hadn&#8217;t posted a bug report on trac yet was because he didn&#8217;t like opening tickets without a patch or solid way to reproduce the error.<br />
Dr. Hannibal Lecter returned a apologized that it was not his intention to be unfair against the CakePHP team, and that he really appreciated their efforts. He was however puzzled that the creators of such a great framework as CakePHP would neglect <a target="_blank" href="http://bakery.cakephp.org">The Bakery</a>and made a rather good point: If new users use the bakery, and its full of errors, what would they think of the underlying framework as well?<br />
Adam Royle returned to the discussion and tried to get answers on his two original questions</p>
<ul>
<li>He was unhappy wit the quality of <a target="_blank" href="http://bakery.cakephp.org/articles/view/want-to-order-your-sql">this article on the bakery</a>
</li>
<li>What version of cake is the bakery running on? (1.2 pre-historic afaik)
</li>
</ul>
<p>Chris Hartjes, our favorite grumpy Canadian, closed the thread with a few harsh comments I&#8217;m not going to quote here <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Larry E. Masters aka PhpNut posted his announcement on the new 1.2 beta at: <a title="Google group: New Year, New Beta" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/d57865a5fb1dbd2e">New Year, New Beta</a>, that received a few &#8220;thanks&#8221;, but nothing else of interested.</p>
<h4>Require SSL for entire site?</h4>
<p>Bryan Encina asked if it was possible to <a title="Google group: Require SSL for entire site?" target="blank" href="http://groups.google.com/group/cake-php/browse_thread/thread/6420e8565e15cf29">Require SSL for entire site?</a>. His own idea was to check $_SERVER['HTTPS'] in his AppController, and then redirect based on this. Chris Hartjes questioned the safety of $_SERVER['HTTPS'] (its perfectly safe), to his understanding, it was possible to spoof (its not) this variable. His suggestion was to limit access on webserver level instead of application level.</p>
<p>I (Christian Winther) pointed out that mod_rewrite would be a perfect solution for this problem, since the RewriteCond directive could check for both SERVER_PORT (port 80 = non ssl, port 443 = ssl) and SERVER_PROTOCOL (http = non ssl, https = ssl)<br />
. Robby Anderson suggested using the SecurityComponent::requireSecure() method instead, also a possible solution if you wish to let ssl management be up to the application (htaccess will most likely perform alot better if its just for redirect).<br />
Chris Hartjes returned to the thread because he had felt a bit wierd about his earlier reply to the group, and confirmed that $_SERVER['HTTPS'] indeed cannot be spoofed. He suggested using Robby&#8217;s solution.</p>

	Tags: <a href="http://www.cakephp.nu/t/cakephp" title="Cakephp" rel="tag">Cakephp</a>, <a href="http://www.cakephp.nu/t/english" title="english" rel="tag">english</a>, <a href="http://www.cakephp.nu/t/weekly-summaries" title="weekly summaries" rel="tag">weekly summaries</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.cakephp.nu/cakephp-weekly-summaries-issue-1/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>CakeFest website launched!</title>
		<link>http://www.cakephp.nu/cakefest-website-launched</link>
		<comments>http://www.cakephp.nu/cakefest-website-launched#comments</comments>
		<pubDate>Wed, 02 Jan 2008 18:02:37 +0000</pubDate>
		<dc:creator>Christian Winther</dc:creator>
				<category><![CDATA[Cakephp]]></category>
		<category><![CDATA[english]]></category>

		<guid isPermaLink="false">http://www.cakephp.nu/cakefest-website-launched</guid>
		<description><![CDATA[
Just in on google group &#8211; the cake fest website has been launched. Head over to the cakefest website and join the fun Cakefest is the first global meetup for CakePHP (and probably also other PHP programmers) ever, so its going to be very excited Tags: Cakephp, english
]]></description>
			<content:encoded><![CDATA[<p>Just in on google group &#8211; the cake fest website has been launched.</p>
<p><a target="_blank" href="http://www.cakefest.org/">Head over to the cakefest website and join the fun</a></p>
<p>Cakefest is the first global meetup for CakePHP (and probably also other PHP programmers) ever, so its going to be very excited</p>

	Tags: <a href="http://www.cakephp.nu/t/cakephp" title="Cakephp" rel="tag">Cakephp</a>, <a href="http://www.cakephp.nu/t/english" title="english" rel="tag">english</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.cakephp.nu/cakefest-website-launched/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP 1.2 beta has been released</title>
		<link>http://www.cakephp.nu/cakephp-12-beta-released</link>
		<comments>http://www.cakephp.nu/cakephp-12-beta-released#comments</comments>
		<pubDate>Wed, 02 Jan 2008 11:22:04 +0000</pubDate>
		<dc:creator>Christian Winther</dc:creator>
				<category><![CDATA[Cakephp]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://www.cakephp.nu/cakephp-12-beta-released</guid>
		<description><![CDATA[
Finally it happened ! CakePHP 1.2 beta has been released. Some of the new stuff includes: Reverse routing for array based urls RESTful automagic Forms are easier to create and maintain Security enhancements for better CSRF prevention and HTTP Authentication CookieComponent for securely storing persistent data on the client side Model behaviors The &#8220;with&#8221; key [...]
]]></description>
			<content:encoded><![CDATA[<p>Finally it happened !</p>
<p><strong>CakePHP 1.2 beta</strong> has been released.</p>
<p>Some of the new stuff includes:</p>
<ul>
<li>Reverse routing for array based urls</li>
<li>RESTful automagic</li>
<li>Forms are easier to create and maintain</li>
<li>Security enhancements for better CSRF prevention and HTTP Authentication</li>
<li>CookieComponent for securely storing persistent data on the client side</li>
<li>Model behaviors</li>
<li>The &#8220;with&#8221; key allows you to define a dynamic join table model</li>
<li>Pagination of model records with an extensive helper</li>
<li>Internationalization and Localization</li>
<li>Authentication component</li>
<li>Configure class to provide dynamic handling of configuration settings</li>
<li>Cache Engine (memcache, xcache, apc, model, file)</li>
<li>Console</li>
</ul>
<p>View the rest of the changes at <a target="_blank" href="http://bakery.cakephp.org/articles/view/new-year-new-beta">the bakery announcement</a> made by PHPnut</p>
<p>I have been using the 1.2 branch for more than a year now, and it has been a real pleasure to see how development has moved in a very interested direction. Being in the -dev channel I have also been able to follow some of the discussions on what can stay and what can go. The result, a very clean codebase with a lot of cool features, that is very easy (and <strong>fast!</strong>) to use.</p>
<p>One of my personal favorites has to be the new ModelBehavior feature. Its incredible easy to work with, and makes its very easy to add new features to a already running project without having to hack your way into either Cake or App code <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>One of the few things I miss is the possibility to return a result set in Model::beforeFind &#8211; so it would be possible to create a simple cache mechanism for your query data (together with the new cache engines). Its possible, but requires a little bit of overloading of Model::find to get it to play nicely, oh well <img src='http://www.cakephp.nu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

	Tags: <a href="http://www.cakephp.nu/t/cakephp" title="Cakephp" rel="tag">Cakephp</a>, <a href="http://www.cakephp.nu/t/english" title="english" rel="tag">english</a>, <a href="http://www.cakephp.nu/t/news" title="news" rel="tag">news</a>, <a href="http://www.cakephp.nu/t/release" title="release" rel="tag">release</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.cakephp.nu/cakephp-12-beta-released/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc

Served from: www.cakephp.nu @ 2012-02-05 16:07:58 -->
