<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://www.symforc.com/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
  <title>Symfony Resources Central</title>
  <link>http://www.symforc.com/</link>
  <description>A place that groups many original symfony resources, along with my personal experiments of this great PHP5 MVC framework.</description>
  <language>en</language>
  <pubDate>Thu, 03 Jul 2008 11:14:40 +0200</pubDate>
  <copyright>All rights reserved</copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Symfony 1.1 is out, and the winner is... 1.2!</title>
    <link>http://www.symforc.com/post/2008/07/01/Symfony-11-is-out-and-the-winner-is-12</link>
    <guid isPermaLink="false">urn:md5:85f53cbd1b862e7ec8d83c276fe0c581</guid>
    <pubDate>Tue, 01 Jul 2008 23:52:00 +0200</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>release</category>
        <category>1.1</category><category>1.2</category><category>deployment</category><category>doctrine</category><category>javascript</category><category>release</category>    
    <description>&lt;p&gt;The longly awaited 1.1 version is finally out after long months of development. After doing this, Fabien started the 1.2 branch, and you can take a look at &lt;a href=&quot;http://trac.symfony-project.com/changeset/10000&quot; hreflang=&quot;fr&quot;&gt;that magnificient revision&lt;/a&gt; which for sure opens a new era of symfony developments.&lt;/p&gt;    &lt;p&gt;A lot of nice new features are greatly awaited in the next version.&lt;/p&gt;


&lt;p&gt;First of all, the admin generator will be completely rewritten, to make a good use of the new form framework. That will for sure open incredible new possibilities and remove the permanent need for hacks to customize your own admin interface (or frontend interface, if you do use admin generation in frontend too). At least, the first one amazed more than one person, and we can be pretty sure that new version will kick asses.&lt;/p&gt;


&lt;p&gt;Some people were complaining about Ruby on Rails having a great advantage over symfony, by their deployment tool Capistrano, while symfony only allow to rsync to one server. Hopefully this won't be true for long anymore. For information, Capistrano allows to create real deployment scripts, like &quot;Disable frontend app on this server, make backups of site and database, synchronize, remotely run tests, clear the cache and enable the frontend app&quot;. That will easify a lot our projects delivery procedures.&lt;/p&gt;


&lt;p&gt;Amongst some other details, the last major point Symfony 1.2 will see is some further decoupling of the technical choices symfony 1.0  gave us, like Propel or Prototype. Prototype and the helpers will still be bundled with symfony, but as a plugin, like Propel is since 1.1. This is very important IMHO, because symfony should never force any technical choice to the teams. But many people complained that helpers was one of the easy and magic things that attract newcomers to symfony. The plugin solution is keeping everyone happy. In the same spirit, symfony 1.2 will bundle the sfDoctrine plugin thanks to Jonathan Wage work to stabilise and manage branches/features.&lt;/p&gt;


&lt;p&gt;And for the short term, the unpublished chapters of the form framework online book are still to come too, along with a symfony 1.1 &quot;First project&quot; tutorial.&lt;/p&gt;


&lt;p&gt;Long life to symfony :-)&lt;/p&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2008/07/01/Symfony-11-is-out-and-the-winner-is-12#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2008/07/01/Symfony-11-is-out-and-the-winner-is-12#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/76</wfw:commentRss>
      </item>
    
  <item>
    <title>Towards symfony 1.1</title>
    <link>http://www.symforc.com/post/2008/06/16/Towards-symfony-11</link>
    <guid isPermaLink="false">urn:md5:a03732439a4dea12611b213272b2c593</guid>
    <pubDate>Mon, 16 Jun 2008 23:55:00 +0200</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>discussion</category>
        <category>1.1</category><category>documentation</category><category>symfony</category><category>upgrade</category>    
    <description>&lt;p&gt;After &lt;a href=&quot;http://www.symfony-project.org/blog/2007/02/19/symfony-1-0-released&quot; hreflang=&quot;en&quot; title=&quot;Symfony 1.0 release&quot;&gt;more than one year&lt;/a&gt; since symfony 1.0 was released, symfony 1.1 goes more and more mature each day. Recent RC releases are a proof of it, but many people are still concerned about whether or not they should migrate.&lt;/p&gt;    &lt;h3&gt;Documentation?&lt;/h3&gt;


&lt;p&gt;Many people are complaining about the fact it lacks documentation. In fact, it seems that many people fears that because François &lt;a href=&quot;http://redotheweb.com/2008/05/16/no-one-is-irreplaceable/&quot; hreflang=&quot;en&quot; title=&quot;François Zaninotto leaves symfony core team&quot;&gt;announced he was leaving the symfony core team&lt;/a&gt;, nobody would take care of documenting the project.&lt;/p&gt;


&lt;p&gt;But that's something any big open-source project come to see one day, a former or important team member leaves the project, because he or she doesn't have anymore time for it, differ views, change interest, or whatever else.&lt;/p&gt;


&lt;p&gt;As he said, no-one is irreplaceable, and new people comes in too, hopefully. Developpers from many countries started recently to fix and translate existing documentation for symfony 1.1, a new mailing list is being created for documentors and the symfony core team is currently putting a great effort on it too.&lt;/p&gt;


&lt;h3&gt;Documentation!&lt;/h3&gt;


&lt;p&gt;The symfony documentation page is split by version and language, and the 1.1 english version is getting attention to adapt parts of it in the need. But even without that, if you know symfony 1.0 pretty well, you should not have hard time to updating, as every changed part were because they were judged too complex, or not &quot;clean&quot; enough. The new way to do things is usually easier.&lt;/p&gt;


&lt;p&gt;To demonstrate it, people from symfony core team published a little serie of articles on symfony-project.org recently:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.prendreuncafe.com&quot; hreflang=&quot;fr&quot; title=&quot;Prendre un café, blog de Nicolas Perriault&quot;&gt;Nicolas Perriault&lt;/a&gt; published an article about &lt;a href=&quot;http://www.symfony-project.org/blog/2008/06/12/internationalize-your-propel-forms&quot;&gt;form internationalization&lt;/a&gt;, something you could not do to do so easily with symfony 1.0 helpers.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.aide-de-camp.org/&quot; title=&quot;Aide de Camp, Fabien Potencier&quot;&gt;Fabien Potencier&lt;/a&gt; demonstrated &lt;a href=&quot;http://www.symfony-project.org/blog/2008/06/09/how-to-create-an-optimized-version-of-your-website-for-the-iphone-in-symfony-1-1&quot; hreflang=&quot;en&quot; title=&quot;How to create an optimized version of your website for the iphone in symfony 1.1&quot;&gt;how handy was the new sf_format feature&lt;/a&gt;, to provide the same logical content within different formats, or for instance, different views. He also explained &lt;a href=&quot;http://www.symfony-project.org/blog/2008/06/09/how-to-customize-the-directory-structure-in-symfony-1-1&quot; hreflang=&quot;en&quot; title=&quot;how to customize a project&amp;#039;s directory structure&quot;&gt;how to customize a project's directory structure&lt;/a&gt;, showing the use of ApplicationConfiguration and ProjectConfiguration classes.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.carlsoft.net/&quot; hreflang=&quot;en&quot; title=&quot;Carl&amp;#039;s homepage&quot;&gt;Carl Vondrick&lt;/a&gt; explained &lt;a href=&quot;http://www.symfony-project.org/blog/2008/05/30/how-do-i-use-propel-1-3-in-symfony-1-1&quot; hreflang=&quot;en&quot; title=&quot;How to use Propel 1.3 in symfony 1.1&quot;&gt;how to use Propel 1.3 to boost your ORM layer performances&lt;/a&gt; (be aware though that PHP 5.2 is needed, while symfony 1.1 only requires PHP 5.1.4).&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dakrazy.net&quot; hreflang=&quot;en&quot; title=&quot;Romain Dorgueil&amp;#039;s homepage&quot;&gt;I&lt;/a&gt; published two little tutorials about &lt;a href=&quot;http://www.symfony-project.org/blog/2008/06/10/how-to-send-emails-in-symfony-1-1&quot; hreflang=&quot;en&quot; title=&quot;How to send emails in symfony 1.1&quot;&gt;sending emails&lt;/a&gt; and &lt;a href=&quot;http://www.symfony-project.org/blog/2008/06/14/batches-are-dead-long-life-to-tasks&quot; hreflang=&quot;en&quot; title=&quot;Batches are dead, long life to tasks&quot;&gt;using tasks&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And more are to come, of course!&lt;/p&gt;


&lt;h3&gt;And about forms?&lt;/h3&gt;


&lt;p&gt;The only part of symfony which needs a bit of learning is the new form framework, which is quite radically different from the 1.0 way to create form. And about this, Fabien recently announced he will &lt;a href=&quot;http://www.symfony-project.org/blog/2008/06/06/documentation-updates&quot; hreflang=&quot;en&quot; title=&quot;The article in which Fabien announces the publication of a book dedicated to symfony 1.1 forms&quot;&gt;publish an entire book about it&lt;/a&gt;.&lt;/p&gt;


&lt;h3&gt;To migrate or not to migrate&lt;/h3&gt;


&lt;p&gt;Symfony 1.0 is Long Term Support version, which means that symfony team will go on fixing bugs for three years since the original release. If your project is nearly released or already released, I would not bother upgrading, because you would not benefit of symfony 1.1 new features, while you'd suffer the upgrade process.&lt;/p&gt;


&lt;p&gt;On the other hand, if your project is very young, I think the time to take the step is now, the official 1.1 release being real soon. You'd benefit of all new features with a very active community and a very reactive development team.&lt;/p&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2008/06/16/Towards-symfony-11#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2008/06/16/Towards-symfony-11#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/75</wfw:commentRss>
      </item>
    
  <item>
    <title>Overview of symfony 1.1 event dispatcher</title>
    <link>http://www.symforc.com/post/2008/04/30/Overview-of-symfony-11-event-dispatcher</link>
    <guid isPermaLink="false">urn:md5:a6dc9a4f45b15c54b5b47a85f8484d45</guid>
    <pubDate>Wed, 30 Apr 2008 23:56:00 +0200</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>how-to</category>
        <category>cocoa</category><category>event dispatcher</category><category>plugins</category><category>symfony1.1</category>    
    <description>    &lt;p&gt;As you may now by now, Symfony 1.1 introduces a new powerfull event dispatcher inspired by Apple Cocoa's NotificationCenter. Basically, it allows any entity to &quot;listen&quot; to events, and get a call on the registered callback if this event ever happens.&lt;/p&gt;


&lt;p&gt;Symfony 1.1 provides &lt;a href=&quot;http://trac.symfony-project.com/wiki/Symfony11Events&quot; hreflang=&quot;en&quot;&gt;some default events&lt;/a&gt; you can listen to, but of course you can create your own events if you need.&lt;/p&gt;


&lt;h2&gt;Listen to an event&lt;/h2&gt;


&lt;p&gt;To listen to an event, you need to use the &quot;connect&quot; method on the event dispatcher instance. The first parameter is the event name, and the second is a PHP callable that will get called if the event happens.&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$dispatcher&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;connect&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'user.change_culture'&lt;/span&gt;, &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;'listenToChangeCultureEvent'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/code&gt;&lt;/div&gt;


&lt;h2&gt;Create a custom event&lt;/h2&gt;


&lt;p&gt;To use the dispatcher for your own needs, you just need to define your event name in your project specifications, and send notifications to it. Depending on the behaviour needed, three options are offered:&lt;/p&gt;


&lt;h3&gt;Simple notifications&lt;/h3&gt;


&lt;p&gt;The simpliest way is to notify all listeners with the -&amp;gt;notify method.&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$dispatcher&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;notify&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; sfEvent&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;'my.super.cool.event'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/code&gt;&lt;/div&gt;


&lt;h3&gt;Notifications until something&lt;/h3&gt;


&lt;p&gt;Sometimes, you prefer to notify all listeners until one says &quot;Ok guys, I handled this one. Don't worry about it anymore&quot;.&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$dispatcher&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;notifyUntil&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; sfEvent&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;'my.super.cool.event'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;The first listener that will return non-false value will stop the event chain.&lt;/p&gt;


&lt;h3&gt;Filtering notifications&lt;/h3&gt;


&lt;p&gt;The last notifying method is called filtering. You set this up when you want to permit anything to act as a filter on something, meaning any listener can modify a source object.&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$dispatcher&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;filter&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; sfEvent&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;'my.super.cool.event'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$objectToFilter&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;Every listener must return the filtered value (or the original object if nothing was done) to pass to the next listener.&lt;/p&gt;


&lt;h2&gt;Practical use: Register routes in your plugins&lt;/h2&gt;


&lt;p&gt;One of the first practical applications that came to me was the new way of registering routes in plugins. In symfony 1.0, a coincidence made possible to use the routing in a plugin's config.php but that's not possible anymore in symfony 1.1, so you have to use the event dispatcher. To accomplish this, we're going to set up a routing.load_configuration listener in the plugin's config.php:&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;dispatcher&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;connect&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'routing.load_configuration'&lt;/span&gt;, &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'myPluginRouting'&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;'listenToRoutingLoadConfigurationEvent'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;Then you just need to create the callback class/method:&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; myPluginRouting&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp;* Listens to the routing.load_configuration event.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;*&lt;br /&gt;
&amp;nbsp; &amp;nbsp;* @param sfEvent An sfEvent instance&lt;br /&gt;
&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/static&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;static&lt;/span&gt;&lt;/a&gt; public &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; listenToRoutingLoadConfigurationEvent&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;sfEvent &lt;span style=&quot;color: #0000ff;&quot;&gt;$event&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$r&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$event&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;getSubject&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// preprend our routes&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$r&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;prependRoute&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'my_route'&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;'/my_plugin/:action'&lt;/span&gt;, &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'module'&lt;/span&gt; =&amp;gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'myPluginAdministrationInterface'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;Here we go :-D&lt;/p&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2008/04/30/Overview-of-symfony-11-event-dispatcher#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2008/04/30/Overview-of-symfony-11-event-dispatcher#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/74</wfw:commentRss>
      </item>
    
  <item>
    <title>Don't be fooled by awkward view.yml js/css positionning syntax!</title>
    <link>http://www.symforc.com/post/2008/04/21/Dont-be-fooled-by-assets-awkyard-positionning-syntax</link>
    <guid isPermaLink="false">urn:md5:296fd00edeb6726ed1b095155c5ded28</guid>
    <pubDate>Mon, 21 Apr 2008 23:55:00 +0200</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>how-to</category>
        <category>assets</category><category>configuration</category><category>css</category><category>js</category><category>view</category>    
    <description>    &lt;p&gt;Short post today about advanced view.yml configuration (in symfony 1.0, and 1.1) for assets.&lt;/p&gt;


&lt;p&gt;You can give additional options to &quot;javascripts:&quot; and &quot;stylesheets:&quot; sections, but the sin equa non condition is to know about the yet very un-documented view.yml assets syntax.&lt;/p&gt;


&lt;p&gt;So here it is:&lt;/p&gt;

&lt;pre&gt;
  javascripts: [ jquery: { position: first } ]
  stylesheets: [ mycss: { position: last, media: screen } ]
&lt;/pre&gt;


&lt;p&gt;I don't know if there are others options like thoose available, but taken the 'position' attribute apart, which is extracted to become the $position method argument of sfWebResponse::addJavascript() and ::addStylesheet, any other option is passed in the $options array.&lt;/p&gt;


&lt;p&gt;Methods prototypes below:&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; sfWebResponse ...&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/* ... */&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; public &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; addJavascript&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$js&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$position&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;''&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$options&lt;/span&gt; = &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; public &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; addStylesheet&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$css&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$position&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;''&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$options&lt;/span&gt; = &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/* ... */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2008/04/21/Dont-be-fooled-by-assets-awkyard-positionning-syntax#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2008/04/21/Dont-be-fooled-by-assets-awkyard-positionning-syntax#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/72</wfw:commentRss>
      </item>
    
  <item>
    <title>HashBin now available in open-source flavor</title>
    <link>http://www.symforc.com/post/2008/03/17/HashBin-now-available-in-open-source-flavor</link>
    <guid isPermaLink="false">urn:md5:247514b555b0056152208ebb017f329f</guid>
    <pubDate>Mon, 17 Mar 2008 23:58:00 +0100</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>sites</category>
        <category>doctrine</category><category>gpl</category><category>hashbin</category><category>opensource</category><category>release</category><category>symfony</category>    
    <description>    &lt;p&gt;Our first violin missed his plane yesterday, so Kwatuor is still not available in the upcoming unusable buggy pre-alpha (that miss all the functionalities anyway).&lt;/p&gt;


&lt;p&gt;But while we're waiting for him to be available, I released HashBin in open-source, so anybody can dive into the code, and help me making it evolve. It still needs many attention, but hey, time is not the most available resource I have, and that's one of the two major reasons to give it to the community. Another one is that there is not so much open source symfony applications, and even less open source doctrine applications. After the doctrine 1.0 feature-freeze announcement, this could be a step to have simple sample applications (I hear little sarcastic laughs in the background...) people could dive in to learn this amazing ORM.&lt;/p&gt;


&lt;p&gt;Well stop talking, here is the code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TRAC web interface: &lt;a href=&quot;http://trac.dakrazy.net/&quot; hreflang=&quot;en&quot;&gt;http://trac.dakrazy.net/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SVN DAV repository: &lt;a href=&quot;http://svn.dakrazy.net/hashbin/trunk/&quot; hreflang=&quot;en&quot;&gt;http://svn.dakrazy.net/hashbin/trunk/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SVN access is read-only for anyone, if you ever want to contribute, I'll be glad to grant you a commit access either on trunk or branch (still have to make up my mind, but at beginning that's not very important). Just ask me on IRC (hartym@freenode).&lt;/p&gt;


&lt;p&gt;What amazing feature will you invent today?&lt;/p&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2008/03/17/HashBin-now-available-in-open-source-flavor#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2008/03/17/HashBin-now-available-in-open-source-flavor#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/71</wfw:commentRss>
      </item>
    
  <item>
    <title>I'd like to hear a Kwatuor play nice symfonic music</title>
    <link>http://www.symforc.com/post/2008/02/26/Id-like-to-hear-a-Kwatuor-play-nice-symfonic-music</link>
    <guid isPermaLink="false">urn:md5:b3bb840e13f98b2a073f5e55b1307bcf</guid>
    <pubDate>Tue, 26 Feb 2008 23:58:00 +0100</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>discussion</category>
        <category>blog</category><category>doctrine</category><category>dotclear</category><category>gpl</category><category>open-source</category><category>project</category><category>symfony</category><category>template</category><category>wordpress</category>    
    <description>    &lt;p&gt;Today's post is a bit special.&lt;/p&gt;


&lt;p&gt;This can be took as a question.&lt;/p&gt;


&lt;p&gt;Or a call to developpers that have specific blogging needs.&lt;/p&gt;


&lt;p&gt;Since quite a moment I used dotclear for blogging. That suit my needs, in some way, but maybe I'm more adaptating my needs to dotclear's capabilities. Maybe you're using wordpress. or any other. And I guess that must be the same for you, thinking for example of integrating one of those all-in-one blogging/cms platforms cleanly in another website, for example, is being more than utopian...&lt;/p&gt;


&lt;p&gt;By clean I mean integrating it without having to duplicate the template. Neither having to use all functionalities if you only need a simple article list somewhere... And without being limited if you need to display the headers of those on another website...&lt;/p&gt;


&lt;p&gt;I'd better not speak of blog networks communicating, or taking content from RSS/XML/anything feed in a flexible way.&lt;/p&gt;


&lt;p&gt;So today I'd like to announce the birth of Kwatuor. Kwatuor is a blog platform project using symfony and doctrine, that will in the near future use doctrine migrations to get content from an existing dotclear/wordpress project, or any other source platform someone has enough need with he'd take the time to write migration classes for.&lt;/p&gt;


&lt;p&gt;Templating system will be different. I'm still hesitating between a generator approach (generated partials from a dynamic skeleton, that all can be customizable) and a real proper template system (but still any part would be customizable). Only major difference with blogging platform would be the total forbidding of DRY-breaks a dotclear-like templating system is doing everyday. And this extends to integrated blogs, in wider projects.&lt;/p&gt;


&lt;p&gt;In fact I started developing it for my own needs, but I think this is typically the kind of project everybody would need someday. Maybe you hate being jailed in your obscure, yet very good, but specific and... even more obscure blog platform.&lt;/p&gt;


&lt;p&gt;So I'm wondering now, if people (you :p) would be interested in this project. If so, I'll make a public SVN/trac next week, so concerned users will be able to give feedback with code in their hands. Would this be usefull to you? Would you contribute to this open-source project? Do you have good (or bad :p) ideas about concepts to take in consideration from the beginning?&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;Related links&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.phpdoctrine.org/documentation/manual/trunk/?chapter=migration&quot; hreflang=&quot;en&quot;&gt;Doctrine Migrations&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2008/02/26/Id-like-to-hear-a-Kwatuor-play-nice-symfonic-music#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2008/02/26/Id-like-to-hear-a-Kwatuor-play-nice-symfonic-music#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/69</wfw:commentRss>
      </item>
    
  <item>
    <title>Complex relations population in propel</title>
    <link>http://www.symforc.com/post/2008/01/31/Complex-relations-population-in-propel</link>
    <guid isPermaLink="false">urn:md5:e7d99dbbc10d08b0818277af69fe8c44</guid>
    <pubDate>Thu, 31 Jan 2008 23:47:00 +0100</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>plugin</category>
        <category>database</category><category>dry</category><category>orm</category><category>performance</category><category>plugin</category><category>propel</category><category>symfony</category>    
    <description>    &lt;p&gt;Since quite a bit, I've been faced with an annoying problem on every projects I use propel on. Propel builders only generates some specific cases selection methods, which consists of pretty ugly copy paste of the same code to populate the objects, and if your needs are not satisfied by the finite little number of propel handled cases, you'll have to either use pure SQL, or write a custom doSelect method. That seems okay at first sight, but it is not. In fact, you're about copypasting the propel generated method, and that's a rude violation of D.R.Y. principle.&lt;/p&gt;


&lt;p&gt;I found no solutions during the two last years, but maybe things will change soon with the new sfPropelImpersonatorPlugin. This plugin is aiming at doing arbitrary object population based on informations provided by propel's introspection methods (DatabaseMap/TableMap/ColumnMap) to link populated objects.&lt;/p&gt;


&lt;p&gt;The plugin is currently in very early stage, but is working pretty well for my needs, and I'm looking forward to know what others are thinking about it.&lt;/p&gt;


&lt;p&gt;Related links:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.dakrazy.net/document/sf_propel_impersonator_documentation.html&quot; hreflang=&quot;en&quot;&gt;sfPropelImpersonatorPlugin documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://trac.symfony-project.com/wiki/sfPropelImpersonatorPlugin&quot; hreflang=&quot;en&quot;&gt;sfPropelImpersonatorPlugin README&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://trac.symfony-project.com/browser/plugins/sfPropelImpersonatorPlugin/trunk&quot; hreflang=&quot;php&quot;&gt;Browse the source&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2008/01/31/Complex-relations-population-in-propel#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2008/01/31/Complex-relations-population-in-propel#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/65</wfw:commentRss>
      </item>
    
  <item>
    <title>sfForms11Plugin: use symfony 1.1 form/validation framework in symfony 1.0 or non-symfony project</title>
    <link>http://www.symforc.com/post/2008/01/07/sfForms11Plugin%3A-use-symfony-11-form/validation-framework-in-symfony-10-or-non-symfony-project</link>
    <guid isPermaLink="false">urn:md5:666b80dc063d678906505c2a407ccb27</guid>
    <pubDate>Mon, 07 Jan 2008 23:32:00 +0100</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>plugin</category>
        <category>1.1</category><category>forms</category><category>plugin</category>    
    <description>    &lt;p&gt;The new symfony 1.1 form/validation framework is 100% symfony-independant, and though is not limited to the (very) awaited 1.1 stable release. To use it in your own symfony 1.0 projects, you can use sfForms11Plugin. It's content is very thin: it only sets up externals to symfony 1.1 form/widget/validator libraries.&lt;/p&gt;


&lt;p&gt;To use it, simply add the following external to your project:&lt;/p&gt;

&lt;pre&gt;
sfForms11Plugin http://svn.symfony-project.com/plugins/sfForms11Plugin
&lt;/pre&gt;


&lt;p&gt;Or check it out from your project base directory:&lt;/p&gt;

&lt;pre&gt;
svn co http://svn.symfony-project.com/plugins/sfForms11Plugin plugins/sfForms11Plugin
&lt;/pre&gt;


&lt;h2&gt;Let's try it...&lt;/h2&gt;


&lt;p&gt;Now you'll be able to define sfForm sub-classes to materialize forms:&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; HelloWorldForm extends sfForm&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; public &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; configure&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; public &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; setup&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setWidgetSchema&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; sfWidgetFormSchema&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff0000;&quot;&gt;'name'&lt;/span&gt; =&amp;gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; sfWidgetFormInput&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setValidatorSchema&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; sfValidatorSchema&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff0000;&quot;&gt;'name'&lt;/span&gt; =&amp;gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; sfValidatorString&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'required'&lt;/span&gt;=&amp;gt;true, &lt;span style=&quot;color: #ff0000;&quot;&gt;'min_length'&lt;/span&gt;=&amp;gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;'max_length'&lt;/span&gt;=&amp;gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;widgetSchema&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setNameFormat&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'hello[%s]'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;errorSchema&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; sfValidatorErrorSchema&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;validatorSchema&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; parent::&lt;span style=&quot;color: #006600;&quot;&gt;setup&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;This class define the model of your HelloWorldForm, and you can now use it in your actions:&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; testActions extends sfActions&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; executeHelloWorld&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;form&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; HelloWorldForm&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;getRequest&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;getMethod&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; == sfRequest::&lt;span style=&quot;color: #006600;&quot;&gt;POST&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt; !== &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$hello&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;getRequestParameter&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'hello'&lt;/span&gt;, &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;form&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;bind&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$hello&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;form&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;isValid&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;redirect&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'@hello?name='&lt;/span&gt;.&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;form&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;getValue&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'name'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;At this point, the only little detail still missing is the view, containing actual form display:&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&amp;lt;form method=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;POST&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;
&amp;lt;table&amp;gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$form&lt;/span&gt;; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;td colspan=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;2&amp;quot;&lt;/span&gt; align=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;right&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;input type=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;submit&amp;quot;&lt;/span&gt; value=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Greetings, Mr Computer!&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;That's it! You now have a simple form, self-validating, protected against CSRF attacks and redirecting to some place if values entered matched our sfValidatorSchema.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://trac.symfony-project.com/wiki/sfForms11Plugin&quot; hreflang=&quot;en&quot;&gt;sfForms11 on symfony-project.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-site_request_forgery&quot; hreflang=&quot;en&quot;&gt;About CSRF attacks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2008/01/07/sfForms11Plugin%3A-use-symfony-11-form/validation-framework-in-symfony-10-or-non-symfony-project#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2008/01/07/sfForms11Plugin%3A-use-symfony-11-form/validation-framework-in-symfony-10-or-non-symfony-project#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/64</wfw:commentRss>
      </item>
    
  <item>
    <title>Tired of spam? Try dkAntispamPlugin</title>
    <link>http://www.symforc.com/post/2007/12/30/Tired-of-spam-Try-dkAntispamPlugin</link>
    <guid isPermaLink="false">urn:md5:adadc7894bc07f7826bd8444ddaa0b50</guid>
    <pubDate>Sun, 30 Dec 2007 23:49:00 +0100</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>plugin</category>
        <category>antispam</category><category>geshi</category><category>hashbin</category><category>plugin</category><category>release</category><category>symfony</category>    
    <description>    &lt;p&gt;After last week hashbin's new release, I decided to publish dkAntispamPlugin. That's an early release, and by now it is not very feature-full, but it's doing the job we ask it, and since now, proved efficient on HashBin to make not public the pretty large amount of spam I get on it.&lt;/p&gt;


&lt;p&gt;In One week, we got 40 messages with spam_value&amp;lt;10 (all checked, no spam), 14 more with spam_value&amp;lt;20, some of those were not spam but either inconsistent, or URL-full, 97 more between 20 and 50 (100% spam) and 498 more over this, which i'll consider as spam (don't really feel like reviewing all those).&lt;/p&gt;


&lt;p&gt;For now, the plug-in only makes some reg-exp check, length check and URL count checks, but I'm planning in adding IP check and refining reg-exps to be less CPU eating. If any of you have anymore ideas to improve it... You're all welcome :-)&lt;/p&gt;


&lt;p&gt;At the same time, I refactored sfGeshiPlugin to dkGeshiPlugin, to leave sf prefix for official symfony plugins, so be sure to check the wiki or documentation if you're using it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://trac.symfony-project.com/wiki/dkAntispamPlugin&quot; hreflang=&quot;en&quot;&gt;dkAntispamPlugin on symfony-project.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://trac.symfony-project.com/wiki/dkGeshiPlugin&quot; hreflang=&quot;en&quot;&gt;dkGeshiPlugin on symfony-project.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.dakrazy.net/opensource-portfolio.html&quot; hreflang=&quot;en&quot;&gt;dkGeshi and dkAntispam links&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://hashbin.com/&quot; hreflang=&quot;en&quot;&gt;HashBin&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2007/12/30/Tired-of-spam-Try-dkAntispamPlugin#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2007/12/30/Tired-of-spam-Try-dkAntispamPlugin#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/63</wfw:commentRss>
      </item>
    
  <item>
    <title>Creating custom config handlers in symfony 1.0</title>
    <link>http://www.symforc.com/post/2007/12/24/Basic-config-handler</link>
    <guid isPermaLink="false">urn:md5:0c59293746f0005123d3334c475f927f</guid>
    <pubDate>Mon, 24 Dec 2007 07:30:00 +0100</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>how-to</category>
        <category>1.0</category><category>config</category><category>how-to</category><category>yaml</category>    
    <description>    &lt;p&gt;When writing plugins, you often want to do it the symfony way, by putting configuration stuff in YAML files to allow the final user to override your default values in a harmless way.&lt;/p&gt;


&lt;p&gt;To do this, the correct way is to create a config handler, extending sfConfigHandler, or its child class sfYamlConfigHandler.&lt;/p&gt;


&lt;p&gt;Here is a simple one, just dumping YAML data found in your config file into an sfConfig::get()-able PHP dataset.&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; myStupidConfigHandler extends sfYamlConfigHandler&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; public &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; execute&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$configFiles&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// retrieve yaml data&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$config&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;parseYamls&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$configFiles&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$code&lt;/span&gt; = &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/sprintf&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;sprintf&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&amp;lt;?php&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt; .&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;// auto-generated by myStupidConfigHandler&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt; .&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;// date: %s&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt; .&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;sfConfig::set('my_stupid_config_entry', %s);&amp;quot;&lt;/span&gt;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/date&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;date&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'Y-m-d H:i:s'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;, &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/var_export&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;var_export&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$config&lt;/span&gt;, &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$code&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;We could enhance it a bit, to take advantage of symfony's environments and permit an 'all' (as a default section) and as many environment specific sections as you want. Here is it.&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; myStupidConfigHandler extends sfYamlConfigHandler&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; public &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; execute&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$configFiles&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// retrieve yaml data&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$config&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;parseYamls&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$configFiles&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// get current environment&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$environment&lt;/span&gt; = sfConfig::&lt;span style=&quot;color: #006600;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'sf_environment'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// merge default and environment specific config&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$config&lt;/span&gt; = sfToolKit::&lt;span style=&quot;color: #006600;&quot;&gt;arrayDeepMerge&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/isset&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;isset&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$config&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'all'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;?&lt;span style=&quot;color: #0000ff;&quot;&gt;$config&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'all'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;:&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;, &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/isset&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;isset&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$config&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$environment&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;?&lt;span style=&quot;color: #0000ff;&quot;&gt;$config&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$environment&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;:&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$code&lt;/span&gt; = &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/sprintf&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;sprintf&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&amp;lt;?php&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt; .&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;// auto-generated by myStupidConfigHandler&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt; .&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;// date: %s&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt; .&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;sfConfig::set('my_stupid_config_entry', %s);&amp;quot;&lt;/span&gt;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/date&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;date&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'Y-m-d H:i:s'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;, &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/var_export&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;var_export&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$config&lt;/span&gt;, &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$code&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;Next step will be to tell symfony which configuration file patterns should be loaded using our class. To do this, add the following entry to config/config_handlers.yml (whether in your app, plugin or module, depending on the scope of your config handler)&lt;/p&gt;

&lt;pre&gt;
config/stupid.yml:
  class:    myStupidConfigHandler
&lt;/pre&gt;


&lt;p&gt;Once this is done, the very little remaining last step is to mak sure you include the compiled yml.php file with the following magic command, that will rebuild it when unexistant or outdated:&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;require_once&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;sfConfigCache::&lt;span style=&quot;color: #006600;&quot;&gt;getInstance&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;checkConfig&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'config/stupid.yml'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/* ... */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;$stupid_config&lt;/span&gt; = sfConfig::&lt;span style=&quot;color: #006600;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'my_stupid_config_entry'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;easy one :-)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.yaml.org/&quot; hreflang=&quot;en&quot;&gt;YAML Ain't Markup Language&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.symfony-project.org/api/1_0/sfConfigHandler&quot; hreflang=&quot;en&quot;&gt;sfYamlConfig&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.symfony-project.org/api/1_0/sfYamlConfigHandler&quot; hreflang=&quot;en&quot;&gt;sfYamlConfigHandler&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2007/12/24/Basic-config-handler#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2007/12/24/Basic-config-handler#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/61</wfw:commentRss>
      </item>
    
  <item>
    <title>Hashbin v3 just went to public beta</title>
    <link>http://www.symforc.com/post/2007/12/24/Hashbin-v3-just-went-to-public-beta</link>
    <guid isPermaLink="false">urn:md5:f6f7e344a7a046feafc461c85861bf94</guid>
    <pubDate>Mon, 24 Dec 2007 06:57:00 +0100</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>release</category>
        <category>annoucement</category><category>beta</category><category>doctrine</category><category>hashbin</category><category>paste</category><category>symfony</category><category>tool</category>    
    <description>    &lt;p&gt;I'm proud to annouce that HashBin v3 is out, using the latest improvements to dkGeshi (old sfGeshi, soon public) and the brand new dkAntispamPlugin, which can give a text a note about its probability of being spam, or junk. If everything goes well with hashbin, and after some required (i guess) tuning to the plugin, it will go opensource to let you take advantage of it.&lt;/p&gt;


&lt;p&gt;For thoose who never used it, HashBin is a free PasteBin service, a collaborative debugging tool allowing developpers to share source code snippets. Hashbin is powered by the Symfony Framework and PHP Doctrine ORM.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://hashbin.com/&quot; hreflang=&quot;en&quot;&gt;Hashbin version 3, beta version&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.symfony-project.org/&quot; hreflang=&quot;en&quot;&gt;Symfony Framework&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.phpdoctrine.org/&quot; hreflang=&quot;en&quot;&gt;PHP Doctrine ORM&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2007/12/24/Hashbin-v3-just-went-to-public-beta#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2007/12/24/Hashbin-v3-just-went-to-public-beta#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/62</wfw:commentRss>
      </item>
    
  <item>
    <title>sfGeshi plugin release</title>
    <link>http://www.symforc.com/post/2007/11/04/sfGeshi-plugin-release</link>
    <guid isPermaLink="false">urn:md5:8edc52cd07c2bb0714cb2784a67cbe1e</guid>
    <pubDate>Sun, 04 Nov 2007 23:47:00 +0100</pubDate>
    <dc:creator>Romain</dc:creator>
        <category>release</category>
        <category>geshi</category><category>plugin</category><category>release</category><category>symfony</category><category>update</category>    
    <description>    &lt;p&gt;The sfGeshi plugin has been updated today to use latest GeSHi improvements, and to add some features. The SVN path changed too, to comply with symfony-project.com plugin repository naming conventions, so be sure to check out the &lt;a href=&quot;http://www.dakrazy.net/document/1-SfGeshiDocumentation.html&quot; hreflang=&quot;en&quot;&gt;documentation&lt;/a&gt;.&lt;/p&gt;


&lt;h3&gt;sfGeshi::getLanguages()&lt;/h3&gt;


&lt;p&gt;This static methods allow you to get an associative array of languages, with GeSHi language identifiers as keys and human readable language names as values.&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; select_tag&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'language'&lt;/span&gt;, options_for_select&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;sfGeshi::&lt;span style=&quot;color: #006600;&quot;&gt;getLanguages&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$language&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;



&lt;h3&gt;sfGeshi::getPluginPath()&lt;/h3&gt;

&lt;p&gt;This convenience method has been added to allow you to call sfGeshiPlugin directory differently. It should be used if you need direct access to GeSHi files (like language highlighting definition files in /geshi/).&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;$files&lt;/span&gt; = sfFinder::&lt;span style=&quot;color: #006600;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'file'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'*.php'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;sfGeshi::&lt;span style=&quot;color: #006600;&quot;&gt;getPluginPath&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #ff0000;&quot;&gt;'/geshi/'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;foreach&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$files&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$file&lt;/span&gt; . &lt;span style=&quot;color: #ff0000;&quot;&gt;'=&amp;gt;'&lt;/span&gt; . &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/basename&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;basename&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$file&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;'.php'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2007/11/04/sfGeshi-plugin-release#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2007/11/04/sfGeshi-plugin-release#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/57</wfw:commentRss>
      </item>
    
  <item>
    <title>Using DBMS functions with sfDoctrine</title>
    <link>http://www.symforc.com/post/2007/10/28/Using-aggregate-functions-with-sfDoctrine</link>
    <guid isPermaLink="false">urn:md5:fc9ef2b2d0bb0c63d95b7e7a5ba34427</guid>
    <pubDate>Tue, 30 Oct 2007 22:11:00 +0100</pubDate>
    <dc:creator>Romain</dc:creator>
        <category>how-to</category>
        <category>aggregate</category><category>database</category><category>doctrine</category><category>MySQL</category><category>portability</category><category>sql</category>    
    <description>&lt;p&gt;I recently had a peek on symfony forum, and seen someone asking &quot;How can I make a SELECT count(*) FROM .... with doctrine?&quot;. An answer to such a question should be pretty obvious as it's of everyday use, but the question seems to have come to life many times as well on IRC than on the forum/mailing list. Here is my two-cents how-to.&lt;/p&gt;    &lt;h2&gt;Using builtin DQL aggregate functions&lt;/h2&gt;


&lt;p&gt;Basically, you can add aggregate functions (functions that operates on a group of records instead of one record, also called GROUP BY functions) to your DQL query the same way you'd do in SQL, provided the fact you're using one of the builtin DQL aggregate functions (COUNT, MAX, MIN, AVG, SUM).&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt; = Doctrine_Query::&lt;span style=&quot;color: #006600;&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'COUNT(t.id) cnt'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'Table t'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;execute&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;getFirst&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'cnt'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;;&lt;/code&gt;&lt;/div&gt;


&lt;h2&gt;Using DBMS specific aggregate functions&lt;/h2&gt;


&lt;p&gt;If the function you need is in the list, no need to go further. But some functions are DBMS specific, for example MySQL provides a &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat&quot; hreflang=&quot;en&quot;&gt;GROUP_CONCAT()&lt;/a&gt; function. It would be nonsense for DQL to provide that, as it would not be translatable in some of the other DBMS SQL, but it would also be nonsense to restrict functionalities to the smallest common functionnalities set of every DBMS that Doctrine supports.&lt;/p&gt;


&lt;p&gt;The way to go is to change the &lt;a href=&quot;http://phpdoctrine.net/index.php/documentation/manual?chapter=configuration#general-attributes:portability:portability-mode-constants&quot; hreflang=&quot;en&quot;&gt;portablility level&lt;/a&gt; of doctrine, to match your needs. As the name implies, you're loosing in portability between the different DBMS, but you're gaining specific functionnalities of yours.&lt;/p&gt;


&lt;p&gt;The following code, running in PORTABILITY_ALL mode, will throw a Doctrine_Query_Exception:&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;Doctrine_Manager::&lt;span style=&quot;color: #006600;&quot;&gt;getInstance&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setAttribute&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;Doctrine::&lt;span style=&quot;color: #006600;&quot;&gt;ATTR_PORTABILITY&lt;/span&gt;, Doctrine::&lt;span style=&quot;color: #006600;&quot;&gt;PORTABILITY_ALL&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt; = Doctrine_Query::&lt;span style=&quot;color: #006600;&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'GROUP_CONCAT(t.value) concatedstring'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'Table t'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;execute&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;getFirst&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;Now remove the Doctrine::PORTABILITY_EXPR bit to this attribute, and you will get the correct result (with mySQL):&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;Doctrine_Manager::&lt;span style=&quot;color: #006600;&quot;&gt;getInstance&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setAttribute&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;Doctrine::&lt;span style=&quot;color: #006600;&quot;&gt;ATTR_PORTABILITY&lt;/span&gt;, Doctrine::&lt;span style=&quot;color: #006600;&quot;&gt;PORTABILITY_ALL&lt;/span&gt; ^ Doctrine::&lt;span style=&quot;color: #006600;&quot;&gt;PORTABILITY_EXPR&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt; = Doctrine_Query::&lt;span style=&quot;color: #006600;&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'GROUP_CONCAT(t.value) concatedstring'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'Table t'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;execute&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;getFirst&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'concatedstring'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;;&lt;/code&gt;&lt;/div&gt;



&lt;h2&gt;Extending to other functions&lt;/h2&gt;


&lt;p&gt;Ok aggregate functions are usefull, but other functions can be very handy too, &lt;a href=&quot;http://phpdoctrine.net/index.php/documentation/manual?chapter=dql-doctrine-query-language#functional-expressions:string-functions&quot; hreflang=&quot;en&quot;&gt;string functions&lt;/a&gt; for example. Doctrine manual tells us that builtin DQL string functions are CONCAT, SUBSTRING, TRIM, LOWER, UPPER, LOCATE and LENGTH.&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;Doctrine_Manager::&lt;span style=&quot;color: #006600;&quot;&gt;getInstance&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setAttribute&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;Doctrine::&lt;span style=&quot;color: #006600;&quot;&gt;ATTR_PORTABILITY&lt;/span&gt;, Doctrine::&lt;span style=&quot;color: #006600;&quot;&gt;PORTABILITY_ALL&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;$results&lt;/span&gt; = Doctrine_Query::&lt;span style=&quot;color: #006600;&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'LENGTH(t.value) val_len, t.value'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'Test t'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;execute&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;foreach&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$results&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'value'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; . &lt;span style=&quot;color: #ff0000;&quot;&gt;' =&amp;gt; '&lt;/span&gt; .&lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'val_len'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; .&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;This code will display all records' value fields, followed by their character length computed by the DBMS, in PORTABILITY_ALL mode.&lt;/p&gt;


&lt;p&gt;Now let's say you want to use &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_bit-length&quot; hreflang=&quot;en&quot;&gt;BIT_LENGTH&lt;/a&gt; MySQL function...&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;Doctrine_Manager::&lt;span style=&quot;color: #006600;&quot;&gt;getInstance&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setAttribute&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;Doctrine::&lt;span style=&quot;color: #006600;&quot;&gt;ATTR_PORTABILITY&lt;/span&gt;, Doctrine::&lt;span style=&quot;color: #006600;&quot;&gt;PORTABILITY_ALL&lt;/span&gt; ^ Doctrine::&lt;span style=&quot;color: #006600;&quot;&gt;PORTABILITY_EXPR&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;$results&lt;/span&gt; = Doctrine_Query::&lt;span style=&quot;color: #006600;&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'BIT_LENGTH(t.value) val_len, t.value'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'Test t'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;execute&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;foreach&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$results&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/echo&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'value'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; . &lt;span style=&quot;color: #ff0000;&quot;&gt;' =&amp;gt; '&lt;/span&gt; .&lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'val_len'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; .&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;This is the way to go again.&lt;/p&gt;


&lt;p&gt;No need to say, this extends to every type of functions available in the different DBMS.&lt;/p&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2007/10/28/Using-aggregate-functions-with-sfDoctrine#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2007/10/28/Using-aggregate-functions-with-sfDoctrine#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/55</wfw:commentRss>
      </item>
    
  <item>
    <title>Testing Symfony 1.1</title>
    <link>http://www.symforc.com/post/2006/08/01/Testing-Symfony-11</link>
    <guid isPermaLink="false">urn:md5:cf8260823e8cbbb2b22b67d3075712d6</guid>
    <pubDate>Sun, 28 Oct 2007 12:03:00 +0100</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>discussion</category>
        <category>1.1</category><category>beta</category><category>development</category><category>preview</category><category>symfony</category><category>testing</category><category>upgrade</category>    
    <description>&lt;p&gt;Wondering what symfony 1.1 will look like? Well, I couldn't hold my curiosity neither, so I upgraded one of my websites to symfony 1.1, and I describe here how to setup a box to run both versions. The upgrade process being definitive for a given project, make backups or svn commit before upgrading.&lt;/p&gt;    &lt;p&gt;&lt;strong&gt;WARNING&lt;/strong&gt;: Symfony 1.1 is a development version, and should not be used for production. Use it at your own risks.&lt;/p&gt;



&lt;p&gt;First of all, i did not want the upgrade to be definitive, I needed a simple way to go back to older version. But SVN would handle this, no problem. On an other side, I needed to keep the two symfony version running on the same box, as other sites are running on it.&lt;/p&gt;



&lt;p&gt;My approach to it was to checkout the symfony trunk/lib and trunk/data in /usr/share/pear/symfony1.1 and /usr/share/pear/data/symfony1.1 respectively. This way, i can switch any project I want to symfony 1.1 by changing the config/config.php to use the development version paths.&lt;/p&gt;


&lt;pre&gt;cd /usr/share/pear/
svn co http://svn.symfony-project.com/trunk/lib symfony1.1
svn co http://svn.symfony-project.com/trunk/data data/symfony1.1&lt;/pre&gt;


&lt;p&gt;That should retrieve a local copy of the latest development version on your computer.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Upgrading a 1.0 project&lt;/strong&gt;&lt;/p&gt;



&lt;p&gt;To upgrade a project, your first need is to tell the symfony batch script where to find its libraries. Hopefully, symfony's structure permits to set per-project library paths by changing config/config.php. Edit this file and replace the file content by the new 1.1 paths&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// symfony directories&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;$sf_symfony_lib_dir&lt;/span&gt;&amp;nbsp; = &lt;span style=&quot;color: #ff0000;&quot;&gt;'/usr/share/pear/symfony1.1'&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;$sf_symfony_data_dir&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;'/usr/share/pear/data/symfony1.1'&lt;/span&gt;;&lt;/code&gt;&lt;/div&gt;



&lt;p&gt;You can test your changes were effective by typing symfony in your project directory. You should now see the new namespaced pake tasks that come with symfony 1.1. As in every version, an upgrade pake task that automates the changes you have to make to your project to make it work with the new version is given, and you can do:&lt;/p&gt;



&lt;pre&gt;symfony project:upgrade1.1
symfony cache:clear&lt;/pre&gt;



&lt;p&gt;(Note that old &lt;em&gt;symfony cc&lt;/em&gt; alias still exists for the cache:clear task)&lt;/p&gt;



&lt;p&gt;At this point, I tryed to see if my project would be working, but a nice uncaught LogicException was showing up in development environment, and I had to manually change %project_dir%/apps/*/config/config.php (look at spl_autoload_register line...).&lt;/p&gt;



&lt;p&gt;After a little investigation, i found that running the task twice would autocorrect it, and that it was a little problem in lib/task/project/upgrade1.1/sfAutoloadingUpgrade.class.php, so i sent a ticket on Symfony's TRAC.&lt;/p&gt;



&lt;p&gt;Now you should have your project up and running.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Generating a new 1.1 project&lt;/strong&gt;&lt;/p&gt;



&lt;p&gt;That's easier than upgrading, but the only (little) difficulty comes from the fact that 'symfony' script will look for 1.0 libraries. For this, you'll create a copy of /usr/bin/symfony to /usr/bin/symfony1.1 (you'll need to be root for this), and change its content to:&lt;/p&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#!/usr/bin/env php&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/*&lt;br /&gt;
&amp;nbsp;* This file is part of the symfony package.&lt;br /&gt;
&amp;nbsp;* (c) 2004-2006 Fabien Potencier &amp;lt;fabien.potencier@symfony-project.com&amp;gt;&lt;br /&gt;
&amp;nbsp;* &lt;br /&gt;
&amp;nbsp;* For the full copyright and license information, please view the LICENSE&lt;br /&gt;
&amp;nbsp;* file that was distributed with this source code.&lt;br /&gt;
&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// project exists?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/file_exists&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;file_exists&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'config/config.php'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'config/config.php'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;!&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/isset&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;isset&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$sf_symfony_lib_dir&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/is_readable&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;is_readable&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/dirname&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;dirname&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;__FILE__&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #ff0000;&quot;&gt;'/../../lib/VERSION'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// SVN&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$sf_symfony_lib_dir&lt;/span&gt;&amp;nbsp; = &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/realpath&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;realpath&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/dirname&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;dirname&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;__FILE__&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #ff0000;&quot;&gt;'/../../lib'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$sf_symfony_data_dir&lt;/span&gt; = &lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/realpath&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;realpath&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/dirname&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;dirname&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;__FILE__&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #ff0000;&quot;&gt;'/..'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// PEAR&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$sf_symfony_lib_dir&lt;/span&gt;&amp;nbsp; = &lt;span style=&quot;color: #ff0000;&quot;&gt;'/usr/share/pear/symfony1.1'&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$sf_symfony_data_dir&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;'/usr/share/pear/data/symfony1.1'&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;!&lt;a target=&quot;_blank&quot; href=&quot;http://www.php.net/is_dir&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;is_dir&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$sf_symfony_lib_dir&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; throw &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Exception&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;'Unable to find symfony libraries'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$sf_symfony_data_dir&lt;/span&gt;.&lt;span style=&quot;color: #ff0000;&quot;&gt;'/bin/symfony.php'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/code&gt;&lt;/div&gt;



&lt;p&gt;You can now run&lt;/p&gt;



&lt;pre&gt;symfony1.1 generate:project&lt;/pre&gt;



&lt;p&gt;in a new directory to have a 1.1 project skeleton built there.&lt;/p&gt;




&lt;p&gt;Have fun with it, I'll post articles about the new form/validation system and upgrading your doctrine schemas to the rewritten sfDoctrinePlugin (that works both in 1.0 and 1.1) soon.&lt;/p&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2006/08/01/Testing-Symfony-11#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2006/08/01/Testing-Symfony-11#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/53</wfw:commentRss>
      </item>
    
  <item>
    <title>A new index.php controller for subdomains</title>
    <link>http://www.symforc.com/post/2007/06/28/A-new-indexphp-controller-for-subdomains</link>
    <guid isPermaLink="false">urn:md5:9363e9772236cc82a7a7af275b06db7f</guid>
    <pubDate>Sun, 21 Oct 2007 23:24:00 +0200</pubDate>
    <dc:creator>Romain</dc:creator>
        <category>hacks</category>
        <category>controller</category><category>dns</category><category>hacking</category><category>php</category><category>url</category>    
    <description>&lt;p&gt;The default behaviour of symfony, is to create one myapp.php and one myapp_dev.php public controller by application, knowing that the first application you create will have its prod controller renamed to index.php (default application). But this behaviour can be easily overriden to take advantage of subdomains.&lt;/p&gt;    &lt;p&gt;Here is a little file replacing every public controllers of symfony by an unique index.php, to select the application and environment depending on current subdomain (you can even change it to select depending of the domain though). The aim is to get your different applications on the following domain names:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;http://blog.example.com&lt;/li&gt;
&lt;li&gt;http://blog-dev.example.com&lt;/li&gt;
&lt;li&gt;http://forum.example.com&lt;/li&gt;
&lt;li&gt;http://forum-dev.example.com&lt;/li&gt;
&lt;li&gt;http://www.example.com&lt;/li&gt;
&lt;li&gt;http://www-dev.example.com&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The *-dev domains are the development environment version of their matching non-dev subdomains, and thoose will only be available from authorized IPs, to avoid exposing too much information to the public. You only need to get the source given at the bottom of this article and substitute %project_dir%/web/*.php by this unique index.php, then customize it to fit your applications name and your subdomains.&lt;/p&gt;


&lt;p&gt;Note that in this example, i have a fallback 'website' app for non existing subdomains, that pass the current subdomain to it through the SF_SUBDOMAIN constant. Using this, you could for example give a homepage to each of your users, or create a white label site for each of your clients... Possibilities are just limited by your imagination.&lt;/p&gt;


&lt;p&gt;Related links:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://hashbin.com/V0&quot; hreflang=&quot;php&quot;&gt;index.php source code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    
    
    
          <comments>http://www.symforc.com/post/2007/06/28/A-new-indexphp-controller-for-subdomains#comment-form</comments>
      <wfw:comment>http://www.symforc.com/post/2007/06/28/A-new-indexphp-controller-for-subdomains#comment-form</wfw:comment>
      <wfw:commentRss>http://www.symforc.com/feed/rss2/comments/51</wfw:commentRss>
      </item>
    
  <item>
    <title>sfGeshi plugin</title>
    <link>http://www.symforc.com/post/2007/08/01/sfGeshi-plugin</link>
    <guid isPermaLink="false">urn:md5:ced04d681eb176058000f53fff7b6367</guid>
    <pubDate>Wed, 01 Aug 2007 10:38:00 +0200</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>plugin</category>
        <category>plugin</category><category>presentation</category><category>symfony</category><category>view</category>    
    <description>    &lt;p&gt;sfGeshi's aim is a symfony plugin that integrates the Generic Syntax Highlighter PHP library (GeSHi) into the Symfony Framework. Supports 75 different languages, and you can add more by writing simple php files.&lt;/p&gt;


&lt;p&gt;Related links:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.dakrazy.net/document/1-SfGeshiDocumentation.html&quot; hreflang=&quot;en&quot;&gt;Read the sfGeshi plugin documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://qbnz.com/highlighter/&quot; hreflang=&quot;en&quot;&gt;Read original GeSHi documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Symfony 1.0 is out!</title>
    <link>http://www.symforc.com/post/2007/02/19/Symfony-10-is-out</link>
    <guid isPermaLink="false">urn:md5:e94dbd39cbcfcea567f3df1663e7f890</guid>
    <pubDate>Mon, 19 Feb 2007 08:13:00 +0100</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>release</category>
        <category>doctrine</category><category>MVC</category><category>PHP</category><category>propel</category><category>RAD</category><category>release</category><category>stable</category><category>symfony</category>    
    <description>    &lt;p&gt;Despite the DIGG side effects of which symfony project server suffered because of heavy traffic brought by the well known social bookmarking site's homepage anouncing symfony's first &quot;stable&quot; release, the long awaited 1.0 version is here!&lt;/p&gt;


&lt;p&gt;For thoose who don't know it, Symfony is a MVC (Model-View-Component) PHP5 framework aiming to Rapid Application Development and good codinig practices like the DRY (Don't Repeat Yourself) principle. Their main contributors, french developpers from Sensio Labs Fabien Potencier and François Zaninotto have written a very good documentation book about it, that you can either buy at amazon (for thoose who like holding a real book), or download/read freely on the symfony project website as a PDF file.&lt;/p&gt;


&lt;p&gt;Supported by a large community, you'll find support about symfony in diverse flavour, from the symfony forum to different languages mailing lists, going thru #symfony and #symfony-fr (for french developpers) on Freenode IRC network.&lt;/p&gt;


&lt;p&gt;As the official release note is saying:
&lt;q&gt;At last, the long-awaited 1.0 stable version of symfony is just released. For all those who waited for the &quot;stable&quot; status to dive into symfony, the time has come.&lt;/q&gt;&lt;/p&gt;


&lt;p&gt;Some reference:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.symfony-project.com/&quot; hreflang=&quot;en&quot;&gt;Symfony Project Official Website&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.symfony-forge.com/&quot; hreflang=&quot;en&quot;&gt;Symfony Forge Plugin Repository&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://propel.phpdb.org/&quot; hreflang=&quot;en&quot;&gt;Propel ORM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://doctrine.pengus.net/&quot; hreflang=&quot;en&quot;&gt;Doctrine ORM&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    
    
    
      </item>
    
</channel>
</rss>