<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="/blog/templates/default/atom.css" type="text/css" ?>

<feed 
   xmlns="http://www.w3.org/2005/Atom"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/">
    <link href="http://notjosh.com/blog/feeds/atom.xml" rel="self" title="my life as a sock" type="application/atom+xml" />
    <link href="http://notjosh.com/blog/"                        rel="alternate"    title="my life as a sock" type="text/html" />
    <link href="http://notjosh.com/blog/rss.php?version=2.0"     rel="alternate"    title="my life as a sock" type="application/rss+xml" />
    <title type="html">my life as a sock</title>
    <subtitle type="html">words and word related items</subtitle>
    <icon>http://notjosh.com/blog/templates/default/img/s9y_banner_small.png</icon>
    <id>http://notjosh.com/blog/</id>
    <updated>2008-05-29T05:19:33Z</updated>
    <generator uri="http://www.s9y.org/" version="1.1-beta6">Serendipity 1.1-beta6 - http://www.s9y.org/</generator>
    <dc:language>en</dc:language>

    <entry>
        <link href="http://notjosh.com/blog/archives/56-Google-Hosting-Popular-JS-Libraries.html" rel="alternate" title="Google Hosting Popular JS Libraries" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2008-05-28T05:42:44Z</published>
        <updated>2008-05-29T05:19:33Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=56</wfw:comment>
    
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=56</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/56-guid.html</id>
        <title type="html">Google Hosting Popular JS Libraries</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                I saw this randomly this morning, but I can't find the source.<br />
<br />
In any case, Google are now hosting many popular JavaScript libraries (jQuery, prototype/script.aculo.us, MooTools, dojo) on their own servers - cached, compressed and minified, ready to consume.<br />
<br />
It's as simple as you expect:<br />
<code>&lt;script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js"&gt;&lt;/script&gt;</code><br />
<br />
(though, there's a longer, "better" way to do it if you're that way inclined, also)<br />
<br />
<a href="http://code.google.com/apis/ajaxlibs/">See it here</a> and the <a href="http://googleajaxsearchapi.blogspot.com/2008/05/speed-up-access-to-your-favorite.html">announcement</a> at <a href="http://googleajaxsearchapi.blogspot.com/">AJAX Search API Blog</a> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/55-sfPropelParanoidBehavior-vs-Propel-1.3.html" rel="alternate" title="sfPropelParanoidBehavior vs Propel 1.3" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2008-03-14T04:42:46Z</published>
        <updated>2008-03-14T04:42:46Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=55</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=55</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/55-guid.html</id>
        <title type="html">sfPropelParanoidBehavior vs Propel 1.3</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Just a quick one, mostly for my sake.<br />
<br />
If you're trying to use <code>sfPropelParanoidBehavior</code> with (recent? Since r474 (see <a href="http://propel.phpdb.org/trac/changeset/474">http://propel.phpdb.org/trac/changeset/474</a>)) Propel 1.3, you'll notice the selects aren't filtering out the deleted items.<br />
<br />
Easy fix!<br />
<br />
In <code>plugins/sfPropelParanoidBehavior/config/config.php</code>, change (on line 9) <code>Peer:doSelectRS</code> to read <code>Peer:doSelectStmt</code>. Leave the <code>doSelectRS</code> in the array, that's the callback in the plugin which is fine. 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/54-Custom-Caching-in-symfony.html" rel="alternate" title="Custom Caching in symfony" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2008-02-21T04:40:34Z</published>
        <updated>2008-02-21T04:40:34Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=54</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=54</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/54-guid.html</id>
        <title type="html">Custom Caching in symfony</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Just quickly, because it's handy and simple.<br />
<br />
I'm building a page that's reading a twitter-feed to display on the front page. I don't want to be hitting twitter on every page hit though (obviously), so we need to cache the data. Could it be any simpler? (Thanks symfony! *cheesy wink*)<br />
<br />
Let's dive into the code:<br />
<br />
<code class="textmate-source mac_classic"><span class="source source_php"><span class="source source_php source_php_embedded source_php_embedded_block source_php_embedded_block_html"><span class="punctuation punctuation_definition punctuation_definition_embedded punctuation_definition_embedded_begin punctuation_definition_embedded_begin_php">&lt;?php</span><br /><span class="constant constant_other constant_other_php"></span><span class="meta meta_function meta_function_php"><span class="storage storage_modifier storage_modifier_php">public </span><span class="storage storage_type storage_type_function storage_type_function_php">function</span> <span class="entity entity_name entity_name_function entity_name_function_php">executeIndex</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_php">(</span>)</span><br />{<br />&#160;&#160;&#160;&#160;<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>cache</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">sfFileCache</span>(<span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">cache_dir</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span> <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">/tmp/twitter</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span>)<span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span><br /><br />&#160;&#160;&#160;&#160;<span class="keyword keyword_control keyword_control_php">if</span> (<span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">!</span><span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>cache</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">has</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">tweet</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>))<br />&#160;&#160;&#160;&#160;{<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>status</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="support support_class support_class_php">TwitterFeed</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">::</span><span class="meta meta_function-call meta_function-call_static meta_function-call_static_php">getLatestTweet</span>(<span class="support support_class support_class_php">sfConfig</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">::</span><span class="meta meta_function-call meta_function-call_static meta_function-call_static_php">get</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">app_twitter_user_id</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>))<span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>cache</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">set</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">tweet</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>, <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>status</span>, <span class="constant constant_numeric constant_numeric_php">600</span>)<span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span>     <span class="comment comment_line comment_line_double-slash comment_line_double-slash_php"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php">//</span> 10 mins cache expiry</span><br />&#160;&#160;&#160;&#160;}<br /><br />&#160;&#160;&#160;&#160;<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>this</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="variable variable_other variable_other_property variable_other_property_php">status</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>cache</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">get</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">tweet</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>, <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>)<span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span><br />}</span></span></code><br />
<br />
<em>Holy crap, that was too easy!</em><br />
<br />
That said, it'd be stupid if it were any harder.<br />
<br />
Now, a few tweaks you could do. You could, instead of caching to <code>/tmp</code>, you could cache to <code>sf_cache_dir</code>, so that a <code>symfony cc</code> would also clear that cached data. Could be handy, but might not be what you want.<br />
<br />
I suppose if you weren't so lazy, you'd pull those out into <code>app.yml</code> variables. I would, if I were you! It's a pity I'm lazy, really. 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/53-Symfony-1.1-Form-Templating.html" rel="alternate" title="Symfony 1.1 Form Templating" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2008-02-08T17:08:43Z</published>
        <updated>2008-02-08T17:08:43Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=53</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=53</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/53-guid.html</id>
        <title type="html">Symfony 1.1 Form Templating</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                So, I'm tired of how the forms look in symfony 1.1. I mean c'mon, tables? We can do better than that.<br />
<br />
Note: we can do better than my solution too, I'm sure, but this is way better than tables!<br />
<br />
So inside of <code>/lib/widget</code>, I've created <code>sfWidgetFormSchemaFormatterJosh.class.php</code> which looks a little like:<br />
<br />
<code class="textmate-source mac_classic"><span class="source source_php"><span class="source source_php source_php_embedded source_php_embedded_block source_php_embedded_block_html"><span class="meta meta_class meta_class_php"><span class="storage storage_type storage_type_class storage_type_class_php">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_php">sfWidgetFormSchemaFormatterPulse</span> <span class="storage storage_modifier storage_modifier_extends storage_modifier_extends_php">extends</span> <span class="entity entity_other entity_other_inherited-class entity_other_inherited-class_php">sfWidgetFormSchemaFormatter</span><br />{</span><br />&#160;&#160;<span class="storage storage_modifier storage_modifier_php">protected</span><br />&#160;&#160;&#160;&#160;<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>rowFormat</span>&#160;&#160;&#160;&#160;<span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">&#160;&#160;=</span> <span class="string string_quoted string_quoted_double string_quoted_double_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">"</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php">&lt;div class=<span class="constant constant_character constant_character_escape constant_character_escape_php">\"</span>form-row<span class="constant constant_character constant_character_escape constant_character_escape_php">\"</span>&gt;<span class="constant constant_character constant_character_escape constant_character_escape_php">\n</span>  %error%%label%<span class="constant constant_character constant_character_escape constant_character_escape_php">\n</span>  %field%%help%<span class="constant constant_character constant_character_escape constant_character_escape_php">\n</span>%hidden_fields%<span class="constant constant_character constant_character_escape constant_character_escape_php">\n</span>&lt;/div&gt;</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">"</span></span>,<br />&#160;&#160;&#160;&#160;<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>errorRowFormat</span>  <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="string string_quoted string_quoted_double string_quoted_double_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">"</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php">&lt;div class=<span class="constant constant_character constant_character_escape constant_character_escape_php">\"</span>error<span class="constant constant_character constant_character_escape constant_character_escape_php">\"</span>&gt;<span class="constant constant_character constant_character_escape constant_character_escape_php">\n</span>%errors%&lt;/div&gt;<span class="constant constant_character constant_character_escape constant_character_escape_php">\n</span></span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">"</span></span><span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span><br />}</span></span></code><br />
<br />
And, from there we need to tell our form to use our own formatter, so in your <code>sfForm</code> (child) class, in either <code>configure()</code> or <code>setup()</code> (I use <code>setup()</code> - I don't know if there is a difference, really. Is there? Anyone?), add the following line:<br />
<br />
<code class="textmate-source mac_classic"><span class="source source_php"><span class="source source_php source_php_embedded source_php_embedded_block source_php_embedded_block_html"><span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>this</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">getWidgetSchema</span>()<span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">setFormFormatterName</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span><span class="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">pulse</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>)<span class="punctuation punctuation_terminator punctuation_terminator_expression punctuation_terminator_expression_php">;</span></span></span></code><br />
<br />
And that's it! Quite simple really. (When the form is rendered, symfony will look for <code>$class = 'sfWidgetFormSchemaFormatter' . ucfirst($name);</code> (where $name is 'josh', or whatever you called your formatter), and does the rendering using that class!)<br />
<br />
For full customisation, have a look in <code>sfWidgetFormSchemaFormatter</code>, and look at the <code>protected</code> variables at the top. They're what you have to play with.<br />
<br />
For examples of other implementations, symfony have their own formatters: <code>sfWidgetFormSchemaFormatterTable</code> (default) and <code>sfWidgetFormSchemaFormatterList</code>.<br />
<br />
Good luck! 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/52-PEAR-Bad!-Phing-Weirdness.html" rel="alternate" title="PEAR Bad! Phing Weirdness" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2007-12-04T11:29:43Z</published>
        <updated>2007-12-04T11:29:43Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=52</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=52</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/52-guid.html</id>
        <title type="html">PEAR Bad! Phing Weirdness</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                So I was just trying to deploy some demo code, and my server was whining at me. Bigtime.<br />
<br />
<code>./symfony propel:build-all-load frontend</code><br />
<br />
Yielded the error:<br />
<br />
<code>Fatal error: Declaration of SequentialTask::addTask() must be compatible with that of TaskContainer::addTask()</code><br />
<br />
The code I had deployed was <em>identical</em> to my local code. The error message even identified the deployed code!<br />
<br />
Something was up.<br />
<br />
<code>INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:<br />
=========================================<br />
PACKAGE          VERSION STATE<br />
Archive_Tar      1.3.2   stable<br />
Console_Getopt   1.2.2   stable<br />
PEAR             1.5.4   stable<br />
Structures_Graph 1.0.2   stable<br />
phing            2.1.1   stable</code><br />
<br />
<em>Ah ha!</em><br />
<br />
<code>sudo pear uninstall phing<br />
uninstall ok: channel://pear.php.net/phing-2.1.1</code><br />
<br />
Success!<br />
<br />
So there you go: PEAR bad, bundled libs good. 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/50-Getting-symfony-1.1-Running.html" rel="alternate" title="Getting symfony 1.1 Running" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2007-11-27T10:45:51Z</published>
        <updated>2007-11-27T18:06:58Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=50</wfw:comment>
    
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=50</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/50-guid.html</id>
        <title type="html">Getting symfony 1.1 Running</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                I was just thinking, I wrote a blog entry about symfony 1.1, without any guide to getting symfony 1.1 up and running. If you're not sure what you're doing, <strong>don't do it</strong>! Wait for the official release (or RC, etc) which will no doubt come with docs as well. You'll probably need them.<br />
<br />
Note: I don't know how well this will run on Windows. I think it should (from looking at <code>symfony.bat</code>), but your mileage may vary. Cross your fingers, let's jump in!<br />
<br />
To get the code, I've been pulling it down from SVN into a local lib directory. Though, there's one thing to think about before we go there.<br />
<br />
We need to decide which code to pull down. The most obvious option is to pull down the <code>trunk/</code> folder, but I've been having some sweet success with the <code>branches/dwhittle/</code> folder. Among other things, the <code>dwhittle</code> branch has Propel 1.3 support, which I'm clearly an avid fan of (after writing sfPropel13Plugin). It's kept fairly well up to date, so it seems fine.<br />
<br />
So, you've chosen a branch, let's pull down the code:<br />
<br />
<ul><li>Navigate to your local repo: <code>cd /&lt;path to local repo (I have it in /Library somewhere)&gt;/</code></li><li>Checkout the code: <code>svn co http://svn.symfony-project.com/branches/dwhittle/ sf11</code> (or use <code>/trunk</code> if you want to stick to trunk.)</li><li>(Optional, for convenience. Or else skip ahead to the third last step) Copy the <code>symfony</code> script somewhere useful: <code>cp sf11/data/bin/symfony ~/util</code></li><li>Edit the <code>symfony</code> script, and add in your lib dirs: (lines 44 and 45, under the PEAR comment) <code>$sf_symfony_lib_dir = '/&lt;path to local repo&gt;/sf11/lib'; $sf_symfony_data_dir = '/&lt;path to local repo&gt;/sf11/data' ;</code></li><li>Run the script! <code>~/util/symfony</code> - there should the list of Pake tasks</li><li>Create a new project folder, and <code>cd</code> into it</li><li>Generate a project! <code>~/util/symfony generate:project &lt;project name&gt;</code></li><li>You should now be able to run <code>symfony</code> and it'll automatically refer to your symfony 1.1 Pake tasks. Success!</li></ul><br />
<br />
From here, you can do the same old tricks, like symlink'ing/svn:externals'ing the symfony libs into <code>lib/vendor/symfony/</code>, and modify <code>config/config.php</code> so you're not referring to the global lib. But that's entirely optional (I only do it because my IDE likes it).<br />
<br />
And for you Windows users, if the steps above broke for you, try including the <code>symfony.bat</code> into your util directory, so that Windows has something to execute. It should work, though!<br />
<br />
Best of luck! 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/47-Symfony-1.1-Forms-and-Validation.html" rel="alternate" title="Symfony 1.1 Forms and Validation" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2007-11-26T10:34:54Z</published>
        <updated>2007-11-27T08:27:30Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=47</wfw:comment>
    
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=47</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/47-guid.html</id>
        <title type="html">Symfony 1.1 Forms and Validation</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Okay, so you want the quick rundown of how forms and validation work in symfony 1.1?<br />
<ul><li>First, download the demo project - <a href="http://notjosh.com/labs/sf11forms.zip">http://notjosh.com/labs/sf11forms.zip</a></li><li>Extract the project to somewhere on your http://localhost/ (the project should run as a sandbox project)</li><li>(Probably only necessary for *nix/Mac) On the command line, navigate to the directory of the project, and run <code>./symfony project:permissions</code></li><li>Point your favourite browser to http://localhost/&lt;your project path&gt;/web/frontend_dev.php/</li></ul><br />
<br />
You'll be presented with a pretty basic form, with some ridiculous validation rules. The scenario we're going for is that this is a user registration form. The validation rules are mostly just so you can see how flexible they are and how to use them.<br />
<br />
That's the quickstart. For an explanation of how it all works, read on!<br />
<br />
Okay, so let's have a look at the file structure of the project. It's very much what you're used to in symfony 1.0. Knowing that, let's head into some code.<br />
<br />
Open your favourite file-browser/IDE to /apps/frontend/modules/user.<br />
<br />
<ul><li>In our actions file, we have one action called 'register'.</li><li>We have two templates - a form, and a page that will just echo the form values once a successful submission is received</li><li>In our module's <code>lib/</code> directory, we have three folders, each with a single class in them. (Note: this is just my convention, you don't need to have the classes in the folders)</li></ul><br />
<br />
Let's start with the things we're used to. Let's have a look in the action:<br />
<br />
<code class="textmate-source mac_classic"><br />
<span class='linenum'>    1</span> <span class="source source_php"><span class="meta meta_function meta_function_php"><span class="storage storage_modifier storage_modifier_php">public </span><span class="storage storage_type storage_type_function storage_type_function_php">function</span> <span class="entity entity_name entity_name_function entity_name_function_php">executeRegister</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_php">(</span>)</span><br />
<span class='linenum'>    2</span> {<br />
<span class='linenum'>    3</span>   <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>form</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">RegisterForm</span>()<span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span><br />
<span class='linenum'>    4</span>   <br />
<span class='linenum'>    5</span>   <span class="keyword keyword_control keyword_control_php">if</span> (<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>this</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">getRequest</span>()<span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">isMethod</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>post<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>)) <br />
<span class='linenum'>    6</span>   {<br />
<span class='linenum'>    7</span>     <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>form</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">bind</span>(<br />
<span class='linenum'>    8</span>       <span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><br />
<span class='linenum'>    9</span>         <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>username<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span> <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>this</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">getRequest</span>(<span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">getParameter</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>username<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>),<br />
<span class='linenum'>   10</span>         <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>password<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span> <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>this</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">getRequest</span>()<span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">getParameter</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>password<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>),<br />
<span class='linenum'>   11</span>         <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>email<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span> <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>this</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">getRequest</span>()<span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">getParameter</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>email<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>),<br />
<span class='linenum'>   12</span>       )<br />
<span class='linenum'>   13</span>     )<span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span> <br />
<span class='linenum'>   14</span>       <br />
<span class='linenum'>   15</span>       <br />
<span class='linenum'>   16</span>     <span class="keyword keyword_control keyword_control_php">if</span> (<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>form</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">isValid</span>()) <br />
<span class='linenum'>   17</span>     {<br />
<span class='linenum'>   18</span>       <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>values</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>form</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">getValues</span>()<span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span><br />
<span class='linenum'>   19</span>         <br />
<span class='linenum'>   20</span>       <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>this</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">setTemplate</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>registered<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>)<span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span><br />
<span class='linenum'>   21</span>         <br />
<span class='linenum'>   22</span>       <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>this</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="variable variable_other variable_other_property variable_other_property_php">values</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>values</span><span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span><br />
<span class='linenum'>   23</span>       <span class="keyword keyword_control keyword_control_php">return</span> <span class="support support_class support_class_php">sfView</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">::</span><span class="constant constant_other constant_other_class constant_other_class_php">SUCCESS</span><span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span><br />
<span class='linenum'>   24</span>     } <br />
<span class='linenum'>   25</span>   }<br />
<span class='linenum'>   26</span>     <br />
<span class='linenum'>   27</span>   <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>this</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="variable variable_other variable_other_property variable_other_property_php">form</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>form</span><span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span><br />
<span class='linenum'>   28</span> }</span><br />
</code><br />
<br />
So, a summary:<br />
<ul><li>We're creating a form.</li><li>We're checking if it's a POST.<ul><li>If so:<ul><li>We'll bind the parameters from the form back to the form object</li><li>We'll check the form passes validation</li><li>If it's valid, pass the values to a new 'registered' template</li></ul></li><li>If not, we'll assign the form variable to the template</li></ul></li></ul><br />
<br />
And how does the default template look?<br />
<br />
<code class="textmate-source mac_classic"><br />
<span class='linenum'>    1</span> <span class="text text_html text_html_basic"><span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">form</span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">action</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span><span class="source source_php source_php_embedded source_php_embedded_line source_php_embedded_line_html"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_php">&lt;?php</span> <span class="support support_function support_function_construct support_function_construct_php">echo</span> <span class="meta meta_function-call meta_function-call_php">url_for</span>(<span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>user/register<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>) <span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_php">?&gt;</span></span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">method</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span>post<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span><br />
<span class='linenum'>    2</span>     <span class="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">table</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span><br />
<span class='linenum'>    3</span>         <span class="source source_php source_php_embedded source_php_embedded_line source_php_embedded_line_html"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_php">&lt;?php</span> <span class="support support_function support_function_construct support_function_construct_php">echo</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>form</span> <span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_php">?&gt;</span></span><br />
<span class='linenum'>    4</span>         <span class="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">tr</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">td</span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">colspan</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span>2<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">input</span> <span class="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">type</span>=<span class="string string_quoted string_quoted_double string_quoted_double_html"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_html">"</span>submit<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_html">"</span></span> /<span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">td</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">tr</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span><br />
<span class='linenum'>    5</span>     <span class="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">table</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span><br />
<span class='linenum'>    6</span> <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">form</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span></span></code><br />
<br />
So, we define a form, echo our form variable and give it a submit button. Easy! (You can modify the presentation of the form and add nested forms in code, but I'll cover that another day..)<br />
<br />
The downside is that it's using tables for presentation. It's my understanding that you can plug in different form templates, but I haven't got that far yet.<br />
<br />
And the other template? Well that looks like:<br />
<br />
<code class="textmate-source mac_classic"><br />
<span class='linenum'>    1</span> <span class="text text_html text_html_basic"><span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">p</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>Form successful! Here are the values:<span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">p</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span><br />
<span class='linenum'>    2</span> <br />
<span class='linenum'>    3</span> <span class="source source_php source_php_embedded source_php_embedded_line source_php_embedded_line_html"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_php">&lt;?php</span> <span class="keyword keyword_control keyword_control_php">foreach</span> (<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>values</span> <span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">as</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>id</span> <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>value</span>): <span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_php">?&gt;</span></span><br />
<span class='linenum'>    4</span>     <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">p</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span><br />
<span class='linenum'>    5</span>         <span class="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">strong</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span><span class="source source_php source_php_embedded source_php_embedded_line source_php_embedded_line_html"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_php">&lt;?php</span> <span class="support support_function support_function_construct support_function_construct_php">echo</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>id</span> <span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_php">?&gt;</span></span><span class="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_inline entity_name_tag_inline_any entity_name_tag_inline_any_html">strong</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span>:<br />
<span class='linenum'>    6</span>         <span class="source source_php source_php_embedded source_php_embedded_line source_php_embedded_line_html"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_php">&lt;?php</span> <span class="support support_function support_function_construct support_function_construct_php">echo</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>value</span> <span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_php">?&gt;</span></span><br />
<span class='linenum'>    7</span>     <span class="meta meta_tag meta_tag_block meta_tag_block_any meta_tag_block_any_html"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&lt;/</span><span class="entity entity_name entity_name_tag entity_name_tag_block entity_name_tag_block_any entity_name_tag_block_any_html">p</span><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_html">&gt;</span></span><br />
<span class='linenum'>    8</span> <span class="source source_php source_php_embedded source_php_embedded_line source_php_embedded_line_html"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_php">&lt;?php</span> <span class="keyword keyword_control keyword_control_php">endforeach</span> <span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_php">?&gt;</span></span></span></code><br />
<br />
Simple, just a <code>foreach</code> over the values. We're outputting the POSTs, basically.<br />
<br />
So far, so good.<br />
<br />
Now we'll get into the nitty-gritty a little more. We'll have a look at how the form object (RegisterForm) is created.<br />
<br />
So, let's take a look at RegisterForm:<br />
<br />
<code class="textmate-source mac_classic"><br />
<span class='linenum'>    1</span> <span class="source source_php"><span class="meta meta_class meta_class_php"><span class="storage storage_type storage_type_class storage_type_class_php">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_php">RegisterForm</span> <span class="storage storage_modifier storage_modifier_extends storage_modifier_extends_php">extends</span> <span class="entity entity_other entity_other_inherited-class entity_other_inherited-class_php">sfForm</span><br />
<span class='linenum'>    2</span> {</span><br />
<span class='linenum'>    3</span> <span class="meta meta_function meta_function_php">    <span class="storage storage_modifier storage_modifier_php">public </span><span class="storage storage_type storage_type_function storage_type_function_php">function</span> <span class="entity entity_name entity_name_function entity_name_function_php">configure</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_php">(</span>)</span><br />
<span class='linenum'>    4</span>     {<br />
<span class='linenum'>    5</span>         <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>this</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">setValidatorSchema</span>(<span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">RegisterValidatorSchema</span>())<span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span><br />
<span class='linenum'>    6</span>         <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>this</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">setWidgetSchema</span>(<span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">RegisterWidgetFormSchema</span>())<span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span><br />
<span class='linenum'>    7</span>     }<br />
<span class='linenum'>    8</span> <br />
<span class='linenum'>    9</span> <span class="meta meta_function meta_function_php">    <span class="storage storage_modifier storage_modifier_php">public </span><span class="storage storage_type storage_type_function storage_type_function_php">function</span> <span class="entity entity_name entity_name_function entity_name_function_php">bind</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_php">(</span><span class="meta meta_function meta_function_arguments meta_function_arguments_php"><span class="meta meta_function meta_function_argument meta_function_argument_no-default meta_function_argument_no-default_php"><span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>taintedValues</span></span></span>)</span><br />
<span class='linenum'>   10</span>     {<br />
<span class='linenum'>   11</span>         <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>request</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="support support_class support_class_php">sfContext</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">::</span><span class="meta meta_function-call meta_function-call_static meta_function-call_static_php">getInstance</span>()<span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">getRequest</span>()<span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span><br />
<span class='linenum'>   12</span>         <span class="keyword keyword_control keyword_control_php">if</span> (<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>request</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">hasParameter</span>(<span class="storage storage_type storage_type_php">self</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">::</span><span class="variable variable_other variable_other_class variable_other_class_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>CSRFFieldName</span>))<br />
<span class='linenum'>   13</span>         {<br />
<span class='linenum'>   14</span>             <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>taintedValues</span>[<span class="storage storage_type storage_type_php">self</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">::</span><span class="variable variable_other variable_other_class variable_other_class_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>CSRFFieldName</span>] <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>request</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">-&gt;</span><span class="meta meta_function-call meta_function-call_object meta_function-call_object_php">getParameter</span>(<span class="storage storage_type storage_type_php">self</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">::</span><span class="variable variable_other variable_other_class variable_other_class_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>CSRFFieldName</span>)<span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span><br />
<span class='linenum'>   15</span>         }<br />
<span class='linenum'>   16</span> <br />
<span class='linenum'>   17</span>         <span class="storage storage_type storage_type_php">parent</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">::</span><span class="meta meta_function-call meta_function-call_static meta_function-call_static_php">bind</span>(<span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>taintedValues</span>)<span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span><br />
<span class='linenum'>   18</span>     }<br />
<span class='linenum'>   19</span> }</span></code><br />
<br />
Take a look at the configure() method, it's the important one. We're assigning the form with a widget schema (a set of form widgets), and a validation schema (the new version of validation YAML). Really simple stuff, definitely.<br />
<br />
Note: I don't know if there's a better way than overriding the bind method. Overriding the bind method is just to transparently manage the CSRF protection. You can ignore that for now - the easy way is to add the extra array option in the action where you call ->bind on the other POST vars.<br />
<br />
Let's look at the widget schema we're using (RegisterWidgetFormSchema):<br />
<br />
<code class="textmate-source mac_classic"><br />
<span class='linenum'>    1</span> <span class="source source_php"><span class="meta meta_class meta_class_php"><span class="storage storage_type storage_type_class storage_type_class_php">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_php">RegisterWidgetFormSchema</span> <span class="storage storage_modifier storage_modifier_extends storage_modifier_extends_php">extends</span> <span class="entity entity_other entity_other_inherited-class entity_other_inherited-class_php">sfWidgetFormSchema</span><br />
<span class='linenum'>    2</span> {</span><br />
<span class='linenum'>    3</span> <span class="meta meta_function meta_function_php">    <span class="storage storage_modifier storage_modifier_php">public </span><span class="storage storage_type storage_type_function storage_type_function_php">function</span> <span class="support support_function support_function_magic support_function_magic_php">__construct</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_php">(</span><span class="meta meta_function meta_function_arguments meta_function_arguments_php"><span class="meta meta_function meta_function_argument meta_function_argument_default meta_function_argument_default_php"><span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>options</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span></span>,<span class="meta meta_function meta_function_argument meta_function_argument_default meta_function_argument_default_php"> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>attributes</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span></span>,<span class="meta meta_function meta_function_argument meta_function_argument_default meta_function_argument_default_php"> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>labels</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span></span>,<span class="meta meta_function meta_function_argument meta_function_argument_default meta_function_argument_default_php"> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>helps</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span></span></span>)</span><br />
<span class='linenum'>    4</span>     {<br />
<span class='linenum'>    5</span>         <span class="storage storage_type storage_type_php">parent</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">::</span><span class="meta meta_function-call meta_function-call_static meta_function-call_static_php">__construct</span>(<br />
<span class='linenum'>    6</span>             <span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><br />
<span class='linenum'>    7</span>                 <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>username<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span> <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">sfWidgetFormInput</span>(<span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span>,<br />
<span class='linenum'>    8</span>                 <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>password<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span>  <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">sfWidgetFormInputPassword</span>(),<br />
<span class='linenum'>    9</span>                 <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>email<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span> <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">sfWidgetFormInput</span>(),<br />
<span class='linenum'>   10</span>             ),<br />
<span class='linenum'>   11</span>             <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>options</span>,<br />
<span class='linenum'>   12</span>             <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>attributes</span>,<br />
<span class='linenum'>   13</span>             <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>labels</span>,<br />
<span class='linenum'>   14</span>             <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>helps</span><br />
<span class='linenum'>   15</span>         )<span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span><br />
<span class='linenum'>   16</span>     }<br />
<span class='linenum'>   17</span> }</span></code><br />
<br />
I'm not certain this is the best way to do this, but it seems to work just fine. I'm overriding the constructor, and passing in the values I know the 'register' form should have (in this case, a 'username', a 'password' and an 'email'). The sfWidgetFormInput is a simple input element (type=text), and predictably the sfWidgetFormInputPassword is just a password input element.<br />
<br />
So there we have it - now we can render a form, and have no validation on it.<br />
<br />
We can do more complex things in here, like nesting different forms and having groups of elements (I think, anyway). But I'll leave that for now.<br />
<br />
So, let's look at our validation rules in RegisterWidgetFormSchema:<br />
<br />
<code class="textmate-source mac_classic"><br />
<span class='linenum'>    1</span> <span class="source source_php"><span class="meta meta_class meta_class_php"><span class="storage storage_type storage_type_class storage_type_class_php">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_php">RegisterValidatorSchema</span> <span class="storage storage_modifier storage_modifier_extends storage_modifier_extends_php">extends</span> <span class="entity entity_other entity_other_inherited-class entity_other_inherited-class_php">sfValidatorSchema</span><br />
<span class='linenum'>    2</span> {</span><br />
<span class='linenum'>    3</span> <span class="meta meta_function meta_function_php">    <span class="storage storage_modifier storage_modifier_php">public </span><span class="storage storage_type storage_type_function storage_type_function_php">function</span> <span class="support support_function support_function_magic support_function_magic_php">__construct</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_begin punctuation_definition_parameters_begin_php">(</span><span class="meta meta_function meta_function_arguments meta_function_arguments_php"><span class="meta meta_function meta_function_argument meta_function_argument_default meta_function_argument_default_php"><span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>options</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span></span>,<span class="meta meta_function meta_function_argument meta_function_argument_default meta_function_argument_default_php"> <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>messages</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span></span></span>)</span><br />
<span class='linenum'>    4</span>     {<br />
<span class='linenum'>    5</span>         <span class="storage storage_type storage_type_php">parent</span><span class="keyword keyword_operator keyword_operator_class keyword_operator_class_php">::</span><span class="meta meta_function-call meta_function-call_static meta_function-call_static_php">__construct</span>(<br />
<span class='linenum'>    6</span>             <span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><br />
<span class='linenum'>    7</span>                 <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>username<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span> <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">sfValidatorString</span>(<span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span>,<br />
<span class='linenum'>    8</span>                 <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>password<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span> <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">sfValidatorAny</span>(<br />
<span class='linenum'>    9</span>                     <span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><br />
<span class='linenum'>   10</span>                         <span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">sfValidatorString</span>(<span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>min_length<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span> <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="constant constant_numeric constant_numeric_php">10</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span>,<br />
<span class='linenum'>   11</span>                         <span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">sfValidatorRegex</span>(<span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>pattern<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span> <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="string string_regexp string_regexp_single-quoted string_regexp_single-quoted_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'/</span><span class="keyword keyword_operator keyword_operator_regexp keyword_operator_regexp_php">^</span>\d<span class="string string_regexp string_regexp_arbitrary-repitition string_regexp_arbitrary-repitition_php"><span class="punctuation punctuation_definition punctuation_definition_arbitrary-repitition punctuation_definition_arbitrary-repitition_php">{</span>2<span class="punctuation punctuation_definition punctuation_definition_arbitrary-repitition punctuation_definition_arbitrary-repitition_php">}</span></span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">/'</span></span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span>),<br />
<span class='linenum'>   12</span>                     )<br />
<span class='linenum'>   13</span>                 ),<br />
<span class='linenum'>   14</span>                 <span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>email<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span> <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">sfValidatorAll</span>(<br />
<span class='linenum'>   15</span>                     <span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><br />
<span class='linenum'>   16</span>                         <span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">sfValidatorString</span>(<span class="meta meta_array meta_array_php"><span class="support support_function support_function_construct support_function_construct_php">array</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_begin punctuation_definition_array_begin_php">(</span><span class="string string_quoted string_quoted_single string_quoted_single_php"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_php">'</span>min_length<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_php">'</span></span> <span class="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span class="constant constant_numeric constant_numeric_php">10</span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span><span class="punctuation punctuation_definition punctuation_definition_array punctuation_definition_array_end punctuation_definition_array_end_php">)</span></span>,<br />
<span class='linenum'>   17</span>                         <span class="keyword keyword_other keyword_other_new keyword_other_new_php">new</span> <span class="support support_class support_class_php">sfValidatorEmail</span>(),<br />
<span class='linenum'>   18</span>                     )<br />
<span class='linenum'>   19</span>                 )<br />
<span class='linenum'>   20</span>             ),<br />
<span class='linenum'>   21</span>             <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>options</span>,<br />
<span class='linenum'>   22</span>             <span class="variable variable_other variable_other_php"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_php">$</span>messages</span><br />
<span class='linenum'>   23</span>         )<span class="keyword keyword_operator keyword_operator_terminator keyword_operator_terminator_php">;</span><br />
<span class='linenum'>   24</span>     }<br />
<span class='linenum'>   25</span> }</span></code><br />
Similar to above, I'm just overriding the constructor as passing in validators (making sure the array keys match the inputs defined in the widget schema).<br />
<br />
Let's take a closer look at our (wildly stupid) validation rules:<br />
<br />
<ul><li>username: simple string validator. This should be fairly familiar to symfony 1.0 kind of functionality.</li><li>		password: this gets a bit more complex, our validator is 'sfValidatorAny'. This validator takes an array of parameters (which are other validators). It's like a boolean 'OR' that says "we must match any of the following validators". So what are the possible validators we can match?<ul><li>sfValidatorString, min_length = 10</li><li>sfValidatorRegex, patterm = /^\d{2}/ (for the regex challenged, we must have two numbers at the start of the string)</li></ul>So, in human terms, we must either have a password at least 10 chars long, or we must start our password with two numbers. So, 'abcdefgh' is an invalid password, but 'abcdefghij' is valid, and so is '12abc'.</li><li>email: similar to password, our validator is 'sfValidatorAll'. In the way that sfValidatorAny was 'OR', this is like 'AND'. It says that <em>all</em> of the validators must pass. So what are the validators?<ul><li>sfValidatorString, min_length = 10</li><li>sfValidatorEmail</li></ul>Both of these should be pretty obvious to you - it must be an email that's at least 10 characters long. 'a@b.com' will fail validation, but 'abcde@fghij.com' will pass!</li></ul><br />
<br />
That pretty much wraps it up. It's pretty basic, but it'll give you enough to start building some basic forms and validating them. If I get a chance, I'll run through some more complex stuff another day? Hrm, maybe.<br />
<br />
Best of luck! Happy sf1.1'ing! 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/46-MoBlog-Dennis-Station-Pride.html" rel="alternate" title="MoBlog: Dennis Station Pride" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2007-11-06T21:30:05Z</published>
        <updated>2007-11-11T15:48:41Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=46</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=46</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/46-guid.html</id>
        <title type="html">MoBlog: Dennis Station Pride</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>yep.</p><br />
<p><a class="popfetcherimage" href="http://notjosh.com/blog/uploads/mobile/DSC03042.JPG" target="_blank"><img src="http://notjosh.com/blog/uploads/mobile/DSC03042.thumb.JPG" alt="Click for full size image" /></a></p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/45-Why-Motorsports-Suck!.html" rel="alternate" title="Why Motorsports Suck!" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2007-10-20T17:42:24Z</published>
        <updated>2007-10-22T04:41:59Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=45</wfw:comment>
    
        <slash:comments>3</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=45</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/45-guid.html</id>
        <title type="html">Why Motorsports Suck!</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Over the last few weeks, a lot of what I've seen on (weekend) TV has been centred around motor sports. I was up late watching some random F1 racing, and I gained a whole new appreciation for the way they work. I mean, there's not a lot of room for error - the speed and consistency at which they operate is pretty mind blowing.<br />
<br />
The next event was the inaugural Bathurst 1000. Followed a week or two later by the Phillip Island MotoGP and some miscellaneous drag racing.<br />
<br />
My gripe is the amount of fuel we're completely wasting in the name of entertainment. Hell, ultimately I'm grumpy about the overall amount of fuel/energy we're wasting in most aspects of day-to-day life, but folk doing it on TV set a pretty average precedent.<br />
<br />
I shudder to think about things like the amount of fuel consumed around the Phillip Island MotoGP weekend - not only on the track, but by the ba-jillions of fans, commuting to and from the event.<br />
<br />
From what I understand (which isn't much..), the fuels used in the SUPER ELITE SPORTING VEHICLES is pretty clean, and emits less 'crap' than your general unleaded petrol, but the fact is we're still running out of fossil fuels, and the cost of oil isn't coming down much. At all. And the goal is to be the fastest, not the most efficient (well, in most cases). Then there's the hours poured into testing of new engines and tyres and whatnot, which of course burns more fuel. So all things considered, there's a lot of wastage.<br />
<br />
These days, I go through quite little petrol in my car. I still catch a bus and a train to work (which obviously burns some fuel), but it's definitely better than driving AND having the buses/trains running. The most fuel I've used this year can be attributed to getting to and from the snow, which on reflection, feels horrible. I know I'm merely a drop in the ocean, and I know that in the big picture I'm doing a horribly minor percentage of the damage, but I still can't shake the feeling that I'm doing something I really shouldn't be.<br />
<br />
I really want to go camping, and I really want to go on more road trips around the place, but I still can't justify it to myself. Granted, that little voice in my head likely wouldn't often stop me actually <em>doing</em> whatever I felt I wanted to (going camping, going to the snow), but it still feels pretty average.<br />
<br />
A quick (i.e. likely wrong) calculation. Bathurst 1000 had 18 (or so?) cars starting? Something like that. Hell, let's go ultra conservative here. Let's say 10 cars. To use round (and very optimistic) numbers, let's say it does 10L/100km. So, every car uses 100L of fuel to get through 1000km of track. And because we said there was 10 cars, that's 1000L of fuel used on the day, with 10000km of track covered. And that is <em>very</em> conservative (okay, I did some research now. According to v8supercars.com.au, there were 30 cars starting, with 16 cars finishing the race. So, we're talking at least 16000km of driving, but likely somewhere over 20000km)<br />
<br />
Judging by my service history, so far this year my car has travelled just a little over 10000km in total (which included a winter of trips to the snow). And I can say with near-certainty that my car (2.0 litre, 4 cylinder, all-wheel drive) is a lot more fuel efficient than theirs (despite me having air conditioning and all those other luxuries that reduce overall efficiency). Suddenly I feel a whole lot less guilty in my simple pleasures.<br />
<br />
I'm still not sure about the camping road-trips, though. Time to buy a Prius?<br />
<br />
P.S. I'm sure I'm using the wrong word when I talk about the 'efficiency' of these vehicles. It's completely in their best interests to be as efficient as possible (aerodynamics, not wasting energy from the engine to the wheel, etc). They still use a helluva lot of fuel, though. I guess my car would use a lot of fuel at 300km/h too. Hmm. 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/44-MoBlog-Apology-Denied!.html" rel="alternate" title="MoBlog: Apology Denied!" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2007-09-11T05:10:04Z</published>
        <updated>2007-09-11T05:13:30Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=44</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=44</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/44-guid.html</id>
        <title type="html">MoBlog: Apology Denied!</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>:[</p><br />
<p><a class="popfetcherimage" href="http://notjosh.com/blog/uploads/mobile/DSC02991.JPG" target="_blank"><img src="http://notjosh.com/blog/uploads/mobile/DSC02991.thumb.JPG" alt="Click for full size image" /></a></p><br />
<p>What's worse - they seemed to have stopped making the yoghurt I (occasionally) eat. No more yoghurt evar.</p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/43-Pump-up-the-jam!.html" rel="alternate" title="Pump up the jam!" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2007-09-11T00:55:43Z</published>
        <updated>2007-09-11T01:03:51Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=43</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=43</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/43-guid.html</id>
        <title type="html">Pump up the jam!</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Today isn't a total write-off. I've learnt about jam. And preserves. And Jelly. And conserves!<br />
<br />
Take heed:<br />
<br />
<blockquote>jelly = spread made only with juice<br />
jam = spread made with partial fruit<br />
preserves = spread made with fruit hunks<br />
the difference is in how it's cooked and prepared ;)<br />
</blockquote><br />
<br />
And then I ignorantly ask:<br />
<blockquote>it often gets labelled as the one thing though, right?<br />
'need me some jam!' <br />
</blockquote><br />
<br />
And the reply:<br />
<blockquote>jelly is always clear, made from fruit juice.... jam is always processed whole fruit (envision in a blender) ... and preserves is someone chopping them into hunks and throwing them in ;)<br />
</blockquote><br />
<br />
And because I'm curious:<br />
<blockquote>what about marmalade?<br />
</blockquote><br />
<br />
And the reply?<br />
<blockquote>that's a type of preserves<br />
made with citrus fruit <br />
</blockquote><br />
<br />
And again, curiously (but ignorantly?):<br />
<blockquote>and preserves are the same as conserves?<br />
</blockquote><br />
<br />
Think again, g'friiiend:<br />
<blockquote>conserves is jam ;)<br />
usually from a mixture of fruits<br />
instead of just one<br />
</blockquote><br />
<br />
Thanks <a href="http://elizabethmariesmith.com/"  title="Elizabeth Smith">pal</a>. 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/42-MoBlog-A-protest-against-the-crackdown-on-jay-w.html" rel="alternate" title="MoBlog: A protest against the crackdown on jay w" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2007-08-09T01:40:04Z</published>
        <updated>2007-08-09T01:40:04Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=42</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=42</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/42-guid.html</id>
        <title type="html">MoBlog: A protest against the crackdown on jay w</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>A protest against the crackdown on jay walking?</p><br />
<p><a class="popfetcherimage" href="http://notjosh.com/blog/uploads/mobile/DSC02958.JPG" target="_blank"><img src="http://notjosh.com/blog/uploads/mobile/DSC02958.thumb.JPG" alt="Click for full size image" /></a></p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/41-Java-is-Insecure.html" rel="alternate" title="Java is Insecure" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2007-06-29T01:02:31Z</published>
        <updated>2007-07-02T09:18:44Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=41</wfw:comment>
    
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=41</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/41-guid.html</id>
        <title type="html">Java is Insecure</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                Java is insecure.<br />
<br />
There, I've said it. I'm not a Java developer, and I really don't know the<br />
ins-and-outs of Java development, but that doesn't stop me being ignorant like<br />
the rest of them.<br />
<br />
I'm at work, and a few minutes ago there was a mini-PHP bashing session. First,<br />
the guy opposite me was explaining to me how PHP is vulnerable to SQL injection<br />
attacks. My response was implying that he should stop coding Java applications<br />
without Hibernate (or any other DAO/ORM) and see how far that gets him with<br />
security. The same thing for PHP - I use ORM/DAO tools to assist my development<br />
(not only is it more secure, but i find it much more productive. Win!).<br />
<br />
The problem I find is more about education. As a developer, he<br />
<em>understands</em> SQL injection, and if necessary, he could protect himself<br />
against it. In an ideal world there's automated tools that manage the protection<br />
for you (because human error is just too common). It seems too many PHP<br />
"developers" are not educated enough to deal with the implicit risks involved in<br />
using PHP, or (as mentioned), the human error/laziness kicks in, and security is<br />
overlooked. Maybe there's not the budget for it. Either way, PHP itself is not<br />
at fault.<br />
<br />
So then I migrated over to join the slightly larger group of people bashing PHP.<br />
As I arrived, I was immediately recognised as 'the guy' that would have a vague<br />
idea about what was in question. They were discussing how a site had been<br />
developed in PHP and there was talk of issues integrating a mobile side of the<br />
app, and a guy chirped in saying 'well, I'd probably want to use Java for that'.<br />
Understandable, he knows Java - it's only natural. He mentioned that it was<br />
because they have libraries to assist with that kind of stuff, and went on to<br />
say that PHP couldn't do that same stuff. That's where he crossed the line.<br />
Honestly, I have no idea if PHP has libraries to help out, but that's far from<br />
the point. He was saying how he can use a single tag to generate a different<br />
sized image based on the client's mobile device.<br />
<br />
So, the fact that Java has libraries written makes PHP an inferior platform?<br />
<br />
I just find it awfully arrogant. I mean, I <em>entirely</em> understand where he's<br />
coming from, and I agree that too many PHP applications are insecure and do<br />
things the "long way", but they don't all have to be like that. What was Java<br />
development like before Spring, Hibernate and whatever else is a buzzword in<br />
Java these days? I remember talk of EJBs and Struts, which was all met with<br />
winces of agony - no one wanted to do it. Same deal? Did that make Java any less<br />
attractive? Apparently not.<br />
<br />
This is awfully one side, and trust me, I know there's a right tool for every<br />
job. But I think blind language bashing is just cheap ignorance.<br />
<br />
There are many, <em>many</em> more facets to the PHP vs Java argument which people<br />
should be much more considerate of. Java, whilst being powerful, is certainly<br />
not the tool for every job.<br />
<br />
Go team.<br />
<br />
Many more days like this to come, I anticipate. 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/40-MoBlog-Whats-Cooking.html" rel="alternate" title="MoBlog: What's Cooking?" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2007-06-16T08:30:06Z</published>
        <updated>2007-06-16T08:30:06Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=40</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=40</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/40-guid.html</id>
        <title type="html">MoBlog: What's Cooking?</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>dinnar</p><br />
<p><a class="popfetcherimage" href="http://notjosh.com/blog/uploads/mobile/DSC02888.JPG" target="_blank"><img src="http://notjosh.com/blog/uploads/mobile/DSC02888.thumb.JPG" alt="Click for full size image" /></a></p> 
            </div>
        </content>
        
    </entry>
    <entry>
        <link href="http://notjosh.com/blog/archives/39-The-End-of-a-Chapter.html" rel="alternate" title="The End of a Chapter" />
        <author>
            <name>joshua paul may</name>
            <email>nospam@example.com</email>
        </author>
    
        <published>2007-06-13T14:00:43Z</published>
        <updated>2007-06-13T14:00:43Z</updated>
        <wfw:comment>http://notjosh.com/blog/wfwcomment.php?cid=39</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://notjosh.com/blog/rss.php?version=atom1.0&amp;type=comments&amp;cid=39</wfw:commentRss>
    
    
        <id>http://notjosh.com/blog/archives/39-guid.html</id>
        <title type="html">The End of a Chapter</title>
        <content type="xhtml" xml:base="http://notjosh.com/blog/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                I can haz a new job. It seems to mark the end of a chapter in my life - or perhaps a stanza or some such. I'll be doing really the same thing in the new job as this one, but the fact is I'll be doing it for (and with) different people.<br />
<br />
It has been an interesting lead-up to today over the last four weeks. Ever since I handed my resignation notice in, it's been somewhat of a lottery every day wondering if today was the day that the directors would let people know that I was leaving. See, there was a girl at my work that left just a week or two ago. She gave at least four weeks notice, but the directors didn't announce it until within a week of her leaving - but by this stage, everyone (that cared) already knew that she was going. The directors weren't fooling anyone. Anyway, today had come, and still very few people knew that I was leaving.<br />
<br />
It got interesting when I was asked by Alex if I'd be able to do some work for her some time over the next couple of days. I told her I couldn't, she asked why I couldn't, I told her that I wouldn't be here, she asked where I was going to be, and I told her that I put my four weeks notice in four weeks ago. She was pretty shocked in general, and was even more stunned that no one had told her. It was quite honestly the most awkward moment I've had at Sputnik. It's certainly not my role to tell all of the staff that I was leaving. This moment alone is complete testement to why I'm leaving in the first place.<br />
<br />
So after that, somehow word got around a little bit more that I was leaving, and I guess the directors then realised that today was indeed the day. A bit of a scurry later, Neil (the guy managing the project I've been focussing on over the last couple of months), had a chat to Go, and came to talk to me. He was pretty worried, and Go was super-stressed in general - half a day surely wasn't enough time to initiate the handover that was really, really necessary.<br />
<br />
So whilst at lunch, I missed a call from a number I didn't recognise. When I got back to the office, Rob (a director) caught me as he was heading out. He asked me what my availability was like for the remainder of the week, and if it was possible that I'd be able to stick around until the end of the week because "we forgot to be super organised" about my departure. I told him that I was available, and I let him scurry out. Seriously though, how many weeks of notice do I need to give for a company to get organised? How hard is it to plan a hand-over?<br />
<br />
On top of this, Rob emailed me a few weeks ago asking when my last day was going to be. I told him it'd be the thirteenth, but I was willing to see out the week if required/desired (as my current boss is away ill - I'd help out with the transition as much as possible in his absence). In reply to that email, I got nothing at all. The ball was entirely in their court, but it was ignored. I don't know if they made assumptions from that, but I was never in the loop. All I needed was a quick reply saying 'okay, cool, if you stayed the whole week, that'd be good'.<br />
<br />
So after Rob left, I realised that we didn't really discuss much at all about how it was to pan out. So I drafted an email to Rob basically saying that I'm finishing up today, if I came back tomorrow, it'd be as a freelancer, and I want $95 an hour to do it. I also said that I wasn't sure that I'd need to be there for the entire two days, but it seemed that some documentation was needed, so I'd focus on that, and if necessary/desired, I could complete some programming asks that were outstanding.<br />
<br />
Some time then elapsed, and Rob took a while to return to the office. When he did, he pulled me aside to have a chat about what I put forward to him. First, he started by saying that from the conversation we had, he was implying they'd just extend my employment by a couple more days - meaning I'd be on my already average pay-rate until Friday. I told him that today was the end of my notice period, and four weeks is plenty of time to organise what they wanted, and that if I were to return, it'd be as a freelancer. He then asked how much I wanted to work for, so I told him $95 (just as in the email). He wasn't too impressed, I guess, and asked if that was my best/final/something offer. I told him I'm willing to listen if he wanted to negotiate, so he then actually had the stupidity/balls to ask what I would actually work for. Again, I told him $95. He made a comment that $95 an hour is significantly higher than my current rate, and I told him that I hadn't anticipated on being at work for the next two days, so it'd need to be worth my while to come in. I figured that was fair - if I get paid the right money, and he needs a bit of work done, it's mutually beneficial, right? Of course not! He then asked again if that was final figure, and asked again the exact dollar value of what I was willing to work for, so I again told him that it's $95, and that if he had another figure in his mind, this is the part of negotiation where he puts forward his ideas. Instead of negotiating (which was his idea in the first place?), he stated that "I'm not playing this game", told me that we were done, and walked off.<br />
<br />
Really, I think it was a bit of a stubborn move on their behalf, and a bit of a bold one. In reality, I was willing to work for much less than that, but he wouldn't even engage me at all, so it's lose/lose for them. See, all of the documentation and hand-over stuff hasn't been done at all. Nothing. So even half a day at $95/hr for me would likely save them that much money quite easily. Instead, they'll take someone else off their project (already with pressing deadlines) to spend a day trying to work out how it works, make the minor changes, and then get back to their project again. No deadlines will move back at all, just that someone's going to have to work a whole lot more in order to make up the time. So yeah, they still have my phone number and my hourly rate. I'm willing to help them out, but it's gotta be worthwhile for me. But Jesus, they had four entire weeks to do this. Instead, they got nothing. Sucks to be them.<br />
<br />
So, when Cummo was leaving, he shook my hand and told me not to be a stranger and to drop by some time, and that I knew where the beer fridge is. I kinda paused and told him "yeah, but I totally don't drink". Haha, it was kind of amusing, just how little they really knew me, you know? But yeah, I'm appreciative anyway, it's a nice gesture. I'll probably take them p on it some time.<br />
<br />
But on a soppier note, I'm really going to miss the dudes there. Lunchtimes will likely never be as humorous, and day-to-day musings will likely never be quite so quirky. There are a lot of really talented, interesting people at Sputnik. It's just the (lack of) management that's ruining the experience for everyone. It wouldn't have taken much at all, and I'd still be moderately happily working for them. They'd have a decent worker for a relatively decent pay rate.<br />
<br />
So yes, I'm thankful for my time there, but I'm out there rolling the dice to see what the next phase of life has in store for me. The future is still surely bright, but I'll really miss being there. Thanks for the good times and the smiles and the mutual dissatisfaction and the free beer (that I never drank) and everything else that was good. I'll be in touch, for sure.<br />
<br />
I can has a stick. 
            </div>
        </content>
        
    </entry>

</feed>