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

<channel>
	<title>Blue Horn &#187; Symfony Resources</title>
	<atom:link href="http://bluehorn.co.nz/tag/symfony/feed/" rel="self" type="application/rss+xml" />
	<link>http://bluehorn.co.nz</link>
	<description>New Zealand Web Design &#38; Development (PHP 5, MySQL, Symfony Framework, Apache, Linux)</description>
	<lastBuildDate>Tue, 29 Nov 2011 22:23:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Speed up Symfony by installing APC on Ubuntu</title>
		<link>http://bluehorn.co.nz/2010/01/29/speed-up-symfony-by-installing-apc-on-ubuntu/</link>
		<comments>http://bluehorn.co.nz/2010/01/29/speed-up-symfony-by-installing-apc-on-ubuntu/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 00:44:59 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony Framework]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[pecl]]></category>
		<category><![CDATA[Symfony Resources]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=338</guid>
		<description><![CDATA[APC (Alternative PHP Cache) is an open source code PHP code cache and optimizer (or code accelerator). It is a necessary companion to any Symfony project. So here we go: sudo apt-get update sudo apt-get install php5-dev apache2-dev build-essential apache2-threaded-dev php-pear sudo pecl install apc Then update /etc/php5/apache2/php.ini and add this line: extension=apc.so Have fun! [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>APC (Alternative PHP Cache) is an open source code PHP code cache and optimizer (or code accelerator). It is a necessary companion to any Symfony project. <span id="more-338"></span>So here we go:</p>
<p>sudo apt-get update<br />
sudo apt-get install php5-dev apache2-dev build-essential apache2-threaded-dev php-pear<br />
sudo pecl install apc</p>
<p>Then update /etc/php5/apache2/php.ini and add this line:</p>
<p>extension=apc.so</p>
<p>Have fun!</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2010/01/29/speed-up-symfony-by-installing-apc-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Symfony 1.2 sfForm formatter to add stars on required fields</title>
		<link>http://bluehorn.co.nz/2009/08/31/symfony-12-sfform-formatter-to-add-stars-on-required-fields/</link>
		<comments>http://bluehorn.co.nz/2009/08/31/symfony-12-sfform-formatter-to-add-stars-on-required-fields/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 11:16:27 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Symfony Framework]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[symfony 1.2]]></category>
		<category><![CDATA[Symfony Resources]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=290</guid>
		<description><![CDATA[The following is a form formatter class I developed to automatically add stars * on required fields. Feel free to use it and let me know if it can be improved. You might ask, why not just use setLabels? Firstly, if you already set required fields to true/false in setValidators, why do you have to [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>The following is a form formatter class I developed to automatically add stars * on required fields. Feel free to use it and let me know if it can be improved.</p>
<p>You might ask, why not just use setLabels?</p>
<p>Firstly, if you already set required fields to true/false in setValidators, why do you have to add the stars manually again in setLabels? It just doesn't make sense!</p>
<p>Secondly, using setLabels to add stars is interfering with language translation.</p>
<p>Thirdly, this is I believe a proper (or proper-ish?) way to do this kind of things with sfForm.</p>
<p><span id="more-290"></span></p>
<p>OK, let's get into it!</p>
<p>Below is an example on how to use it in your form class</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> yourForm <span style="color: #000000; font-weight: bold;">extends</span> sfForm
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">function</span> configure<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setWidgets</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      <span style="color: #0000ff;">'first_name'</span>           <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfWidgetFormInput<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'maxlength'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'last_name'</span>            <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfWidgetFormInput<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'maxlength'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'email'</span>                <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfWidgetFormInput<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'maxlength'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">128</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setValidators</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      <span style="color: #0000ff;">'first_name'</span>           <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfValidatorString<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'max_length'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">50</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'last_name'</span>            <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfValidatorString<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'max_length'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">50</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'email'</span>                <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">new</span> sfValidatorEmail<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'max_length'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">128</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$decorator</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> sidFormFormatter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">widgetSchema</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">widgetSchema</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addFormFormatter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'custom'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$decorator</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">widgetSchema</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setFormFormatterName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'custom'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This is optional but you might want to add the following into your css (e.g.: main.css)</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">em<span style="color: #6666ff;">.required</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">1.2em</span><span style="color: #00AA00;">;</span>font-weight<span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>margin<span style="color: #00AA00;">:</span><span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>padding<span style="color: #00AA00;">:</span><span style="color: #933;">0px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
label<span style="color: #6666ff;">.required</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Last but most importantly, save this formatter class in your project lib folder as sidFormFormatter.php:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> sidFormFormatter <span style="color: #000000; font-weight: bold;">extends</span> sfWidgetFormSchemaFormatter <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">protected</span> 
    <span style="color: #000088;">$rowFormat</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #009933; font-weight: bold;">%e</span>rror%<span style="color: #000099; font-weight: bold;">\n</span>&lt;div class=<span style="color: #000099; font-weight: bold;">\&quot;</span>formRow<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;div class=<span style="color: #000099; font-weight: bold;">\&quot;</span>formLabel<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;%label%&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;div class=<span style="color: #000099; font-weight: bold;">\&quot;</span>formField<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #009933; font-weight: bold;">%f</span>ield%<span style="color: #000099; font-weight: bold;">\n</span>%help%&lt;/div&gt;&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\n</span>%hidden_fields%&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$helpFormat</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;div class=&quot;fieldHelp&quot;&gt;%help%&lt;/div&gt;'</span><span style="color: #339933;">,</span> 
    <span style="color: #000088;">$errorRowFormat</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;div&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #009933; font-weight: bold;">%e</span>rrors%&lt;br /&gt;&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> 
    <span style="color: #000088;">$errorListFormatInARow</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;ul&gt;<span style="color: #009933; font-weight: bold;">%e</span>rrors%&lt;/ul&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> 
    <span style="color: #000088;">$errorRowFormatInARow</span> <span style="color: #339933;">=</span>  <span style="color: #0000ff;">&quot;&lt;li class=<span style="color: #000099; font-weight: bold;">\&quot;</span>error<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&amp;darr; <span style="color: #009933; font-weight: bold;">%e</span>rror% &amp;darr;&lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> 
    <span style="color: #000088;">$namedErrorRowFormatInARow</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;li class=<span style="color: #000099; font-weight: bold;">\&quot;</span>error<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&amp;darr; <span style="color: #009933; font-weight: bold;">%e</span>rror% &amp;darr;&lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> 
    <span style="color: #000088;">$decoratorFormat</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #009933; font-weight: bold;">%c</span>ontent%&quot;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * @var sfValidatorSchema
   */</span>
  <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$validatorSchema</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * @var array
   */</span>
  <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * Constructor
   *
   * Params:
   *  - &quot;required_label_class_name&quot; css class name for label tag when the field is required field, the default is 'required'.
   *  - &quot;required_label_format&quot; default is '%label% &lt;em class=&quot;required&quot;&gt;*&lt;/em&gt;'.
   *
   * @param sfWidgetFormSchema $widgetSchema
   * @param sfValidatorSchema $validatorSchema
   * @param array $params
   */</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span>sfWidgetFormSchema <span style="color: #000088;">$widgetSchema</span><span style="color: #339933;">,</span> sfValidatorSchema <span style="color: #000088;">$validatorSchema</span><span style="color: #339933;">,</span> <span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$validatorSchema</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$params</span><span style="color: #339933;">;</span>
    parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$widgetSchema</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * Returns parameter identified with $name or if does not exist, returns $default.
   *
   * @param string $name
   * @param mixed $default
   * @return mixed
   */</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getParameter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$default</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #000088;">$default</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * Generates a label for the given field name.
   *
   * @param  string $name        The field name
   * @param  array  $attributes  Optional html attributes for the label tag
   *
   * @return string The label tag
   */</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> generateLabel<span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attributes</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$is_required</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span> and <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$validator</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">/* @var $validator sfValidatorBase */</span>
&nbsp;
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$validator</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getOption</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'required'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$class_name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'required_label_class_name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$attributes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'class'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$attributes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'class'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$class_name</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">else</span> <span style="color: #000088;">$attributes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'class'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$class_name</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$is_required</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> parent<span style="color: #339933;">::</span><span style="color: #004000;">generateLabel</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attributes</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$is_required</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$format</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'required_label_format'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'%label% &lt;em class=&quot;required&quot;&gt;*&lt;/em&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%label%'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$s</span><span style="color: #339933;">,</span> <span style="color: #000088;">$format</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$s</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>That's it! Don't forget to "symfony cc" (clear cache).</p>
<p>Happy coding!</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2009/08/31/symfony-12-sfform-formatter-to-add-stars-on-required-fields/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Implementing email login with sfGuardPlugin</title>
		<link>http://bluehorn.co.nz/2009/04/29/implementing-email-login-with-sfguardplugin/</link>
		<comments>http://bluehorn.co.nz/2009/04/29/implementing-email-login-with-sfguardplugin/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 08:44:12 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Symfony Framework]]></category>
		<category><![CDATA[sfGuardPlugin]]></category>
		<category><![CDATA[symfony 1.0]]></category>
		<category><![CDATA[Symfony Resources]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=195</guid>
		<description><![CDATA[(* Update: This article is for Symfony 1.0, for Symfony 1.2 implementation go to Symfony 1.2, Propel, and sfGuardPlugin: email login) Most of us use sfGuardPlugin with Symfony Framework for user management (login stuffs). It is a great, popular, and de facto plugin for doing user management in Symfony. Here's the thing, by default, sfGuardPlugin [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>(<strong>* Update:</strong> This article is for Symfony 1.0, for Symfony 1.2 implementation go to <a href="/2009/06/12/symfony-12-propel-and-sfguardplugin-email-login/">Symfony 1.2, Propel, and sfGuardPlugin: email login</a>)</p>
<p>Most of us use <a href="http://www.symfony-project.org/plugins/sfGuardPlugin" target="_blank">sfGuardPlugin</a> with <a href="http://www.symfony-project.org/" target="_blank">Symfony Framework</a> for user management (login stuffs). It is a great, popular, and de facto plugin for doing user management in Symfony.</p>
<p>Here's the thing, by default, sfGuardPlugin does login using usernames, not emails. But for many projects, it is preferable and more suitable to use email for login.</p>
<p>In this article I would like to discuss a way to implement email login using Symfony. I've only tried this in Symfony 1.0,  but this might/should work on 1.1 and 1.2. And I would be very interested to know your experience if you try this method on Symfony 1.1 or Symfony 1.2<span id="more-195"></span></p>
<p><strong>AVOID USING USERNAME FIELD FOR STORING EMAIL!<br />
</strong></p>
<p>Although this is the quickest short cut, I believe that in the longer run, it is not worth it. It is a potential security and privacy issue (explained below), and your sfGuardPlugin is 'not compatible' with all the other plugins (also explained below).</p>
<p>Storing email in username field is a potential security and privacy issue. This is because username and email are two columns of different purposes.</p>
<p>Username tend to be displayed publicly, while email should never be displayed publicly. If you store email in username field, you have to be really careful when using other plugins that depend on sfGuardPlugin, because chances are, they’d display the email stored in username field publicly.</p>
<p>It is also not ‘natural’ to code things like: $this-&gt;sendEmailTo($user-&gt;getUsername());</p>
<p>Try to use sfGuardPlugin and sfSimpleForum, and store email in username field, and you’ll understand what I mean.</p>
<p><strong>So, here is my proposed way of implementing login using email </strong></p>
<p>Firstly, I've implemented this with <strong>Symfony 1.0</strong>! This might/should work with 1.1 and 1.2 but I have not tried it. If you do try it on 1.1 or 1.2, I would be interested to know your experience.</p>
<p>Secondly, you need to install sfGuardPlugin in your project first.</p>
<p><strong>1. Add few columns in user profile in schema.yml<br />
</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">sf_guard_user_profile<span style="color: #339933;">:</span>
  _attributes<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> phpName<span style="color: #339933;">:</span> sfGuardUserProfile <span style="color: #009900;">&#125;</span>
  id<span style="color: #339933;">:</span>
  user_id<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> type<span style="color: #339933;">:</span> integer<span style="color: #339933;">,</span> foreignTable<span style="color: #339933;">:</span> sf_guard_user<span style="color: #339933;">,</span> foreignReference<span style="color: #339933;">:</span> id<span style="color: #339933;">,</span> required<span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> onDelete<span style="color: #339933;">:</span> cascade <span style="color: #009900;">&#125;</span>
  first_name<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> type<span style="color: #339933;">:</span> varchar<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">30</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> required<span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#125;</span>
  last_name<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> type<span style="color: #339933;">:</span> varchar<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">30</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> required<span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#125;</span>
  email<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> type<span style="color: #339933;">:</span> varchar<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">128</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> required<span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> unique<span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Then build your model, e.g.: symfony propel-build-all (<strong>WARNING</strong>: propel-build-all will wipe out all the records in the database of your project!!!!)</p>
<p><strong>2. Add retrieveByEmail in sfGuardUserProfilePeer.php</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> retrieveByEmail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Criteria<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">EMAIL</span><span style="color: #339933;">,</span> <span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addJoin</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">USER_ID</span><span style="color: #339933;">,</span> sfGuardUserPeer<span style="color: #339933;">::</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span>sfGuardUserPeer<span style="color: #339933;">::</span><span style="color: #004000;">IS_ACTIVE</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">doSelectOne</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>3. Create new validator for checking login using email rather than username</strong></p>
<p>Save this as "sfGuardUserByEmailValidator.class.php" in lib folder of your project.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> sfGuardUserByEmailValidator <span style="color: #000000; font-weight: bold;">extends</span> sfValidator
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> initialize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$context</span><span style="color: #339933;">,</span> <span style="color: #000088;">$parameters</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// initialize parent</span>
    parent<span style="color: #339933;">::</span><span style="color: #004000;">initialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$context</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// set defaults</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameterHolder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username_error'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Email or password is not valid.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameterHolder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'password_field'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameterHolder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'remember_field'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'remember'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameterHolder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parameters</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> execute<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$error</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$password_field</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameterHolder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'password_field'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$password_field</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$remember</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$remember_field</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameterHolder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'remember_field'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$remember</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$remember_field</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$email</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$profile</span> <span style="color: #339933;">=</span> sfGuardUserProfilePeer<span style="color: #339933;">::</span><span style="color: #004000;">retrieveByEmail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$profile</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$profile</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getsfGuardUser</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// user exists and active?</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span> and <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getIsActive</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">// password is ok?</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checkPassword</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getUser</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">signIn</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">,</span> <span style="color: #000088;">$remember</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000088;">$error</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameterHolder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username_error'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>4. Override sfGuardAuth config</strong></p>
<p>Save this as 'apps/frontend/modules/sfGuardAuth/validate/signin.yml' (create folders if not already exist in your project).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">methods<span style="color: #339933;">:</span>
  post<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>username<span style="color: #339933;">,</span> password<span style="color: #009900;">&#93;</span>
&nbsp;
names<span style="color: #339933;">:</span>
  username<span style="color: #339933;">:</span>
  required<span style="color: #339933;">:</span>         <span style="color: #009900; font-weight: bold;">true</span>
  required_msg<span style="color: #339933;">:</span>     Your username is required
  validators<span style="color: #339933;">:</span>       <span style="color: #009900;">&#91;</span>userValidator<span style="color: #009900;">&#93;</span>
&nbsp;
password<span style="color: #339933;">:</span>
  required<span style="color: #339933;">:</span>         <span style="color: #009900; font-weight: bold;">true</span>
  required_msg<span style="color: #339933;">:</span>     Your password is required
&nbsp;
userValidator<span style="color: #339933;">:</span>
  <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">:</span>            sfGuardUserByEmailValidator
  param<span style="color: #339933;">:</span>
    password_field<span style="color: #339933;">:</span> password
    remember_field<span style="color: #339933;">:</span> remember</pre></div></div>

<p><strong>5. Execute symfony cc.</strong></p>
<p>That's it for the login mechanism.</p>
<p><strong>What to store in the username column then?</strong></p>
<p>I use up to 10 characters of first name, 3 characters of last name, and a 3-digits random number for usernames.</p>
<p>Use this function to generate unique username for a new user:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> findUniqueUsername<span style="color: #009900;">&#40;</span><span style="color: #000088;">$first_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$last_name</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">srand</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequestParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'first_name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_'</span><span style="color: #339933;">.</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequestParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'last_name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>sfGuardUserPeer<span style="color: #339933;">::</span><span style="color: #004000;">retrieveByUsername</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequestParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'first_name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_'</span><span style="color: #339933;">.</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequestParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'last_name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_'</span><span style="color: #339933;">.</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$username</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Closing</strong></p>
<p>Phew this is a long article! Please do share with me if you try this on Symfony 1.1 or 1.2.</p>
<p><strong>* Update:</strong> This article is for Symfony 1.0, for Symfony 1.2 implementation go to <a href="/2009/06/12/symfony-12-propel-and-sfguardplugin-email-login/">Symfony 1.2, Propel, and sfGuardPlugin: email login</a></p>
<p>Happy Symfonying!!</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2009/04/29/implementing-email-login-with-sfguardplugin/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>How to do SUM with Propel</title>
		<link>http://bluehorn.co.nz/2009/02/06/how-to-do-sum-with-propel/</link>
		<comments>http://bluehorn.co.nz/2009/02/06/how-to-do-sum-with-propel/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 19:37:11 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Symfony Framework]]></category>
		<category><![CDATA[propel]]></category>
		<category><![CDATA[Symfony Resources]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=185</guid>
		<description><![CDATA[http://www.digitalbase.eu/blog/simplifying-queries-using-sum-count-etc-in-propel/ $c-&#62;addSelectColumn('sum('.dbTimeBlockPeer::TOTAL.') as total'); $rs = dbTimeBlockPeer::doSelectRS($c); while ($rs-&#62;next()) { $total = $rs-&#62;getInt(1); } And a real world example from symfony users mailing list (Symfony 1.2): ACTION: $cu = new Criteria(); $cu-&#62;clearSelectColumns(); $cu-&#62;add(DokumentLinikiPeer::DOKUMENT_ID, $this-&#62;getUser()-&#62;getAttribute('dokument_id')); $cu-&#62;addSelectColumn(DokumentLinikiPeer::STAWKI_VAT); $cu-&#62;addSelectColumn('sum('.DokumentLinikiPeer::KWOTA_NETTO.') as SumOfNetto'); $cu-&#62;addSelectColumn('sum('.DokumentLinikiPeer::KWOTA_BRUTTO.') as SumOfBrutto'); $cu-&#62;addGroupByColumn(DokumentLinikiPeer::STAWKI_VAT); $sumy = DokumentLinikiPeer::doSelectStmt($cu); $total = array(); while ($row = $sumy-&#62;fetch(PDO::FETCH_NUM)) { $total[] = [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.digitalbase.eu/blog/simplifying-queries-using-sum-count-etc-in-propel/" target="_blank">http://www.digitalbase.eu/blog/simplifying-queries-using-sum-count-etc-in-propel/</a></p>
<blockquote><p>$c-&gt;addSelectColumn('sum('.dbTimeBlockPeer::TOTAL.') as total');<br />
$rs = dbTimeBlockPeer::doSelectRS($c);<br />
while ($rs-&gt;next()) { $total = $rs-&gt;getInt(1); }</p></blockquote>
<p><a href="http://groups.google.com/group/symfony-users/browse_thread/thread/7a79bc4bd0e16de9" target="_blank"><span id="more-185"></span>And a real world example from symfony users mailing list</a> (Symfony 1.2):</p>
<blockquote><p><strong>ACTION:</strong></p>
<p>$cu = new Criteria();<br />
$cu-&gt;clearSelectColumns();<br />
$cu-&gt;add(DokumentLinikiPeer::DOKUMENT_ID, $this-&gt;getUser()-&gt;getAttribute('dokument_id'));<br />
$cu-&gt;addSelectColumn(DokumentLinikiPeer::STAWKI_VAT);</p>
<p>$cu-&gt;addSelectColumn('sum('.DokumentLinikiPeer::KWOTA_NETTO.') as<br />
SumOfNetto');</p>
<p>$cu-&gt;addSelectColumn('sum('.DokumentLinikiPeer::KWOTA_BRUTTO.') as<br />
SumOfBrutto');</p>
<p>$cu-&gt;addGroupByColumn(DokumentLinikiPeer::STAWKI_VAT);</p>
<p>$sumy = DokumentLinikiPeer::doSelectStmt($cu);</p>
<p>$total = array();</p>
<p>while ($row = $sumy-&gt;fetch(PDO::FETCH_NUM)) {</p>
<p>$total[] = array(<br />
'vat' =&gt; StawkiVatPeer::retrieveByPK($row[0]), // VAT<br />
'netto' =&gt; $row[1], // SumOfNetto<br />
'brutto' =&gt; $row[2], // SumOfBrutto<br />
);</p>
<p>}</p>
<p><strong>TEMPLATE:</strong><br />
&lt;?php foreach($sumy as $suma): ?&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;&lt;?php echo $suma['vat']; ?&gt;&lt;/td&gt;<br />
&lt;td&gt;&lt;?php echo $suma['netto']; ?&gt;&lt;/td&gt;<br />
&lt;td&gt;&lt;?php echo $suma['brutto']; ?&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;?php endforeach ?&gt;</p></blockquote>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2009/02/06/how-to-do-sum-with-propel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Multiple Symfony versions in the same environment</title>
		<link>http://bluehorn.co.nz/2009/02/02/multiple-symfony-versions-in-the-same-environment/</link>
		<comments>http://bluehorn.co.nz/2009/02/02/multiple-symfony-versions-in-the-same-environment/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 09:40:04 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Symfony Framework]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony Resources]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=145</guid>
		<description><![CDATA[I've been using this trick from symfonynerds to run multiple Symfony versions in the same environments. I can now work on projects built on Symfony 1.0, 1.1, and 1.2 simultaneously in the same environment (Ubuntu 8.10). So now, when I want to create a Symfony 1.0 project, I would just execute "$ symfony10 init-project myproject". [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I've been using this trick from <a href="http://symfonynerds.com/blog/?p=123" target="_blank">symfonynerds to run multiple Symfony versions in the same environments</a>. I can now work on projects built on Symfony 1.0, 1.1, and 1.2 simultaneously in the same environment (Ubuntu 8.10).</p>
<p>So now, when I want to create a Symfony 1.0 project, I would just execute "$ symfony10 init-project myproject". And then in the project I would use "$ ./symfony cc" instead of "$ symfony cc".</p>
<p>It worths mentioning that I think this trick is good for development environment but "svn:externals" trick or Symfony freeze are better for production/deployment as each project will have their own copy of Symfony Framework.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2009/02/02/multiple-symfony-versions-in-the-same-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Popular websites built using Symfony Framework</title>
		<link>http://bluehorn.co.nz/2008/12/06/popular-websites-built-using-symfony-framework/</link>
		<comments>http://bluehorn.co.nz/2008/12/06/popular-websites-built-using-symfony-framework/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 08:42:43 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Websites using Symfony]]></category>
		<category><![CDATA[Symfony Resources]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=121</guid>
		<description><![CDATA[Symfony website has a long list of websites built using Symfony Framework, but this is my own list of favorites/highlights. So here we go: Yahoo! Bookmarks, what more to say, it's that giant company. del.icio.us, the popular web 2.0 social bookmarking website. travelbug.co.nz, one of Trademe's websites. w3counter.com, providing detailed web stats to nearly 5,000 [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a href="http://trac.symfony-project.org/wiki/ApplicationsDevelopedWithSymfony" target="_blank">Symfony website has a long list of websites built using Symfony Framework</a>, but this is my own list of favorites/highlights. So here we go:</p>
<ul>
<li><a href="http://bookmarks.yahoo.com/" target="_blank">Yahoo! Bookmarks</a>, what more to say, it's that giant company.</li>
<li><a href="http://del.icio.us/" target="_blank">del.icio.us</a>, the popular web 2.0 social bookmarking website.</li>
<li><a href="http://www.travelbug.co.nz/" target="_blank">travelbug.co.nz</a>, one of <a href="http://trademe.co.nz" target="_blank">Trademe</a>'s websites.</li>
<li><a href="http://www.w3counter.com/" target="_blank">w3counter.com</a>, providing  detailed web stats to nearly 5,000 websites. That's over 300 database  queries per second, over a billion page views being analyzed, over 28  real-time reports for each site, AJAX, RSS feeds, and lots more running  on this framework. All on a single server.</li>
</ul>
<p>To be continued ... I'll keep adding to this list of websites built using Symfony Framework</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2008/12/06/popular-websites-built-using-symfony-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to handle dot in Symfony URL</title>
		<link>http://bluehorn.co.nz/2008/12/04/how-to-handle-dot-in-symfony-url/</link>
		<comments>http://bluehorn.co.nz/2008/12/04/how-to-handle-dot-in-symfony-url/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 07:45:55 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Symfony Framework]]></category>
		<category><![CDATA[Symfony Resources]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=77</guid>
		<description><![CDATA[This problem with dot in Symfony URL is a common issue faced by developers. I've seen people asking about it few times in the symfony-users mailing list, and in fact I have asked about it once. Here's one recent thread about it in the mailing list. Symptom When you have dot in your Symfony URL, [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>This problem with dot in Symfony URL is a common issue faced by developers. I've seen people asking about it few times in the <a title="Symfony users mailing list (Google group)" href="http://groups.google.co.nz/group/symfony-users" target="_blank">symfony-users mailing list</a>, and in fact I have asked about it once. <a href="http://groups.google.co.nz/group/symfony-users/browse_thread/thread/65d928b601bff9f4" target="_blank">Here's one recent thread about it in the mailing list</a>.<span id="more-77"></span></p>
<h3>Symptom</h3>
<p>When you have dot in your Symfony URL, e.g.: "http://localhost/mysymfonyapp/module1/action1/param1/do.do.do", your web application suddenly behaves incorrectly. Either error or something. After debugging, you'd find that the erratic behavior is caused by parameter 'param1' not containing 'do.do.do' (as it should do ... does?).</p>
<h3>Cause</h3>
<p>I found that the problem is caused by Symfony's web/.htaccess. Especially the following line (red):</p>
<p style="padding-left: 30px;"># we skip all files with .something<br />
<span style="color: #ff0000;"> RewriteCond %{REQUEST_URI} \..+$</span><br />
RewriteCond %{REQUEST_URI} !\.html$<br />
RewriteRule .* - [L]</p>
<p>The above htaccess rule basically (as the comment says) skip all URL with dot in it, because it suppose to be URL to image, css, or javascript files. But sometime we do have dot in URL other than for accessing those files, for example if we pass email address in the URL.</p>
<h3>Solution</h3>
<p>There are two possible solutions that I know of.</p>
<p>One solution is to use question mark formatted parameter (e.g.: "module/action?email=bla@blu.com" as opposed to "module/action/email/bla@blu.com") as pointed out <a href="http://groups.google.co.nz/group/symfony-users/msg/374fdc71de984faf" target="_blank">here</a>. I have not tried this myself but seems like a good solution.</p>
<p>The next possible solution is to modify web/.htaccess to suit your situation. For example, in my situation, I needed the dot because it was for email address. So I added the following line (green) which basically tells apache not to skip the URL even if it has dot if it has @ sign:</p>
<p style="padding-left: 30px;"># we skip all files with .something<br />
RewriteCond %{REQUEST_URI} \..+$<br />
<span style="color: #008000;"> RewriteCond %{REQUEST_URI} !@.+$</span><br />
RewriteCond %{REQUEST_URI} !\.html$<br />
RewriteRule .* - [L]</p>
<p>I hope that helps...</p>
<p>Update:</p>
<ul>
<li>Thanks to Nicolas Perriault from Symfony users mailing list (he developed <a href="http://symfonians.net/" target="_blank">symfonians.net</a>). He uses this .htaccess (<a href="http://pastie.org/330755" target="_blank">http://pastie.org/330755</a>) for <a href="http://symfonians.net/" target="_blank">symfonians.net</a>. I did a quick test and seems to work nicely.<a href="http://symfonians.net/" target="_blank"><br />
</a></li>
</ul>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2008/12/04/how-to-handle-dot-in-symfony-url/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why I like Symfony Framework</title>
		<link>http://bluehorn.co.nz/2008/12/04/why-i-like-symfony-framework/</link>
		<comments>http://bluehorn.co.nz/2008/12/04/why-i-like-symfony-framework/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 21:49:07 +0000</pubDate>
		<dc:creator>Sid</dc:creator>
				<category><![CDATA[Symfony Framework]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony Resources]]></category>

		<guid isPermaLink="false">http://bluehorn.co.nz/?p=55</guid>
		<description><![CDATA[I have been doing Java programming for quite a few years. Java is where I got my OOP lessons from and it just makes sense to me, from the multi-threading model, interfaces, abstract classes, encapsulation, to the bean. I became known as Java man, because 1) I was born in Java island, 2) I program [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I have been doing Java programming for quite a few years. Java is where I got my OOP lessons from and it just makes sense to me, from the multi-threading model, interfaces, abstract classes, encapsulation, to the bean.</p>
<p>I became known as Java man, because 1) I was born in Java island, 2) I program Java, 3) I can speak Javanese, and 4) even though unrelated, I also do Javascript.<span id="more-55"></span></p>
<p>On the other hand, I have also been doing a bit of PHP4. Coming from a Java background, PHP4 Object Oriented seems backward, but I love the flexibility of PHP and how it feels right for developing websites.</p>
<p>So when PHP5 with java like OO features was released, I was very ecstatic (in a normal kind of way). And since then I've been looking for a PHP framework that takes full advantage of that java like OO features. I tried few frameworks before currently settled with <a title="Symfony Framework" href="http://symfony-project.org" target="_blank">Symfony Framework</a>.</p>
<p><a href="http://symfony-project.org" target="_blank"><img class="alignleft size-full wp-image-64" style="border: 0pt none; margin: 10px;" title="Symfony" src="http://bluehorn.co.nz/wp-content/uploads/2008/12/symfony.gif" alt="" width="177" height="48" /></a><a title="Symfony Framework" href="http://www.symfony-project.org/" target="_blank">Symfony Framework</a> is a full-stack (comprehensive and complete) framework written in <a title="PHP website" href="http://php.net/" target="_blank">PHP5</a> that take advantage of the Java like OO of PHP5.</p>
<p>Here's few things that I like about Symfony ...</p>
<h3>Well known PHP libraries in one framework</h3>
<p>Symfony Framework does not reinvent the wheel like many other frameworks, instead it integrated the best breed, well known, and matured PHP libraries like <a title="PEAR" href="http://pear.php.net/" target="_blank">PEAR</a>, <a title="Propel" href="http://propel.phpdb.org/" target="_blank">Propel</a>, <a title="Phing" href="http://phing.info/" target="_blank">Phing</a>, and more. I've used PEAR in many occasions before started with Symfony. I've also used ORM (what Propel is) and have used Apache Ant (<a title="Phing" href="http://phing.info/trac/" target="_blank">what Phing is based on</a>). So although I still had to spend time learning Symfony, I was already familiar with its components.</p>
<h3>Plugins</h3>
<p>Symfony supports plugin and hence there are so <a title="Symfony plugins" href="http://www.symfony-project.org/plugins/" target="_blank">many plugins available for Symfony</a>. There are plugins for YUI, Extjs, Doctrine, Smarty, Prototype, JQuery, and more.</p>
<p>There are also high level plugins to add complete features to a Symfony project like:</p>
<ul>
<li>User management plugin</li>
<li>CMS plugin</li>
<li>Blog plugin</li>
<li>Forum plugin</li>
<li>Wiki plugin</li>
<li>Media assets management plugin</li>
<li>Lucene plugin</li>
<li><a title="Symfony plugins" href="http://www.symfony-project.org/plugins/" target="_blank">And many many more</a></li>
</ul>
<p>All of those are available to every Symfony developers list of arsenal. Plugins can be installed into Symfony project manually or via PEAR.</p>
<h3>Scafolding</h3>
<p>One of the best features of Symfony is its CLI commands. You can start a Symfony project in seconds. Just type a command line and all the skeleton of your project is created for you (including skeleton for your project's unit tests). No need to reinvent your own file structures, but if you're not happy with Symfony's default file structures, you can change it.</p>
<h3>Works well with Eclipse</h3>
<p>This one is quite a biggie to me. <a title="Eclipse IDE" href="http://www.eclipse.org/" target="_blank">Eclipse</a> is arguably the best free Java based IDE that has grown (so big) to support many (many!) programming languages including PHP. Personally, I use <a title="Eclipse PDT" href="http://www.eclipse.org/pdt/" target="_blank">Eclipse PDT</a>.</p>
<p>I particularly like the way Eclipse provides auto code completion for Symfony. It is able to parse the classes in your Symfony project and provides auto code completion for them. Notepad just doesn't cut it any longer since I've used Eclipse.</p>
<p>However, there are tricks that you need to know to get Eclipse PDT to code completion all of your Symfony classes (will write in another post).</p>
<h3>Used by big companies</h3>
<p>I'd still use Symfony even if there's no big companies are using it but it's good to know that big companies are starting to notice this framework.</p>
<ul>
<li><a title="Yahoo! Bookmarks using Symfony" href="http://www.symfony-project.org/blog/2006/10/28/yahoo-bookmarks-uses-symfony" target="_blank">Yahoo is using Symfony to develop Yahoo! Bookmarks</a></li>
<li><a title="Delicious using Symfony" href="http://www.symfony-project.org/blog/2007/10/02/delicious-preview-built-with-symfony" target="_blank">Delicious preview was rumored to have been built using Symfony</a>.</li>
</ul>
<h3>Open source (MIT License)</h3>
<p>Last but not least, Symfony is open source which mean the community (thousands of developers) is able to help to maintain it.</p>
<p>So there you go, few things I like about Symfony Framework</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://bluehorn.co.nz/2008/12/04/why-i-like-symfony-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

