<?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>Fri, 29 Jan 2010 06:25:08 +0100</pubDate>
  <copyright>All rights reserved</copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>The Roots - Part I - HTTP is the web's language</title>
    <link>http://www.symforc.com/post/2009/10/02/What-is-HTTP</link>
    <guid isPermaLink="false">urn:md5:34de824dee3daf030efc85683524a156</guid>
    <pubDate>Sun, 24 Jan 2010 23:30:00 +0100</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>the roots</category>
        <category>basics</category><category>development</category><category>http</category><category>protocol</category><category>web</category>    
    <description>&lt;p&gt;Everybody working in web development knows about this, right?&lt;/p&gt;


&lt;p&gt;I realized recently that it was far from being true. While frameworks and ORMs make web developers' job easier and easier, more and more people comes to develop websites without knowing about the real basics. They use relational databases without knowing anything about SQL, and they develop websites without understanding how the client will talk with their website.&lt;/p&gt;


&lt;p&gt;I don't pretend to make a revolution there, but if I bring my car to the car mechanic, I hope he will know a bit more about it than &quot;engine makes power, and so the car is working&quot;. So are my exigences when I ask a specialist to work on a website.&lt;/p&gt;


&lt;p&gt;To give a parallel with playing music, you can learn to play some songs without knowing anything about harmony and rhythm, but is you want to get serious about what you play, it will become an absolute requirement.&lt;/p&gt;


&lt;p&gt;I so decided to make some short articles explaining in simple terms what those basis are, to my humble opinion. First one is about HTTP.&lt;a href=&quot;http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.3&quot; hreflang=&quot;en&quot;&gt;&lt;/a&gt;&lt;/p&gt;    &lt;h2&gt;So what is HTTP ?&lt;/h2&gt;


&lt;p&gt;HTTP is a &lt;strong&gt;communication protocol&lt;/strong&gt; that comes at &lt;strong&gt;application level&lt;/strong&gt;. In easier terms, it means that it's a language that allows two applications to communicate by exchanging &lt;strong&gt;messages&lt;/strong&gt;. How those messages will transit between the two applications is not HTTP purpose, and in a network-less world, you can even imagine exchanging messages on floppy drives. In the real world, we prefer make it transit over networks, using some low levels network protocols like TCP/IP.&lt;/p&gt;


&lt;p&gt;As it's true 99% of the time, we will assume it's always true: HTTP is the communication language, TCP/IP will handle the transport of HTTP messages between actors.&lt;/p&gt;


&lt;p&gt;Let's go back to the original definition.&lt;/p&gt;


&lt;p&gt;HTTP 1.1 (the last protocol version) is defined by &lt;a href=&quot;http://www.w3.org/Protocols/rfc2616/rfc2616.html&quot; hreflang=&quot;en&quot;&gt;RFC 2616&lt;/a&gt;, which says:&lt;/p&gt;


&lt;blockquote&gt;&lt;p&gt;The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. HTTP has been in use by the World-Wide Web global information initiative since 1990.&lt;/p&gt;
&lt;p&gt;
...&lt;/p&gt;
&lt;p&gt;
The HTTP protocol is a request/response protocol. A client sends a request to the server in the form of a request method, URI, and protocol version, followed by a MIME-like message containing request modifiers, client information, and possible body content over a connection with a server. The server responds with a status line, including the message's protocol version and a success or error code, followed by a MIME-like message containing server information, entity metainformation, and possible entity-body content.&lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;This is the absolute minimum to know. HTTP is a communication language, and works in a request-message, response-message way. This is extremely simple. The RFC then explain that it can do much more complicated things, like handling messages that will go through many nodes before reaching destination, but let's keep it simple, and say that from a client or server point of view, it will result in exactly the same thing.&lt;/p&gt;


&lt;p&gt;The RFC also makes clear that HTTP is not dependent on the transport mean:&lt;/p&gt;


&lt;blockquote&gt;&lt;p&gt;HTTP communication usually takes place over TCP/IP connections. The default port is TCP 80, but other ports can be used. This does not preclude HTTP from being implemented on top of any other protocol on the Internet, or on other networks. HTTP only presumes a reliable transport; any protocol that provides such guarantees can be used; the mapping of the HTTP/1.1 request and response structures onto the transport data units of the protocol in question is outside the scope of this specification.&lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;And it will be out of the scope of this blog post too. HTTP doesn't care about how the message transport is done, but it's usually handled by TCP/IP.&lt;/p&gt;


&lt;h2&gt;Messages, requests, responses&lt;/h2&gt;


&lt;p&gt;So the basic communication tool will be &lt;strong&gt;messages&lt;/strong&gt;. A client to server message is called a &lt;strong&gt;request&lt;/strong&gt;, and the server to client &quot;answer&quot; is called a &lt;strong&gt;response&lt;/strong&gt;. Even if it may seems obvious, a response cannot be the server initiative: a client must have made a request, and server response is the response to this request.&lt;/p&gt;


&lt;p&gt;Now we're pretty confident about HTTP messages being Tupperware boxes containing informations. Let's make a step forward and look at how this box content is structured.&lt;/p&gt;


&lt;p&gt;Messages consists of three parts: the &lt;strong&gt;start line&lt;/strong&gt;, the &lt;strong&gt;headers&lt;/strong&gt;, and the &lt;strong&gt;body&lt;/strong&gt;. As each part has specific rules depending on if the message is a request or a response, we'll have a look at both separately.&lt;/p&gt;


&lt;h3&gt;The request&lt;/h3&gt;


&lt;p&gt;The request start line is pretty easy to understand, it will tell the server what we are requesting.&lt;/p&gt;

&lt;pre&gt;
GET /path/to/file/index.html HTTP/1.0
&lt;/pre&gt;


&lt;p&gt;Here it tells we're using HTTP GET method, to retrieve resource located at the /path/to/file/index.html URI (uniform resource identifier). It also contains what protocol variant we're using, to be sure we speak the exact same language.&lt;/p&gt;


&lt;p&gt;I will come back a bit later on what are &lt;strong&gt;HTTP methods&lt;/strong&gt;, and will refer them as &quot;methods&quot; from now on.&lt;/p&gt;


&lt;p&gt;After this, the client will send the headers. Headers are a key-value list of properties, that transmit various informations about the client, it's capabilities, what it's expecting, and the message itself. I won't go over every &lt;a href=&quot;http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.3&quot; hreflang=&quot;en&quot;&gt;standard request headers&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;Depending on what method is used, the request's body may or may not contain data. For example, if we simply get google's homepage, it won't contain any data. If we're uploading a file, or POST-ing form data to the server, the body will be those data container.&lt;/p&gt;


&lt;h3&gt;The response&lt;/h3&gt;


&lt;p&gt;Once server received the request, it will pass it to a handler, which can be about anything. In PHP applications, hosted on an apache server, chances are that apache will call mod_php to handle the request, and build a response it will send back to the client. But that's only one possibility amongst a huge infinite list, which is outside the scope of this blog post.&lt;/p&gt;


&lt;p&gt;Anyway, the handler takes an http request as its input, and builds an http response, starting by the response start line.&lt;/p&gt;

&lt;pre&gt;
HTTP/1.0 200 OK
&lt;/pre&gt;


&lt;p&gt;This is a pretty standard response. Server starts by saying which protocol variant it's using, then sends a computer readable status code, followed by an human readable translation of this status code.&lt;/p&gt;


&lt;p&gt;A &lt;a href=&quot;http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10&quot; hreflang=&quot;en&quot;&gt;complete list of HTTP status codes&lt;/a&gt; is available at many places on the internet, and it's useless to know them all. Googling &quot;http status code&quot; when you're looking for the adequate status should be far enough.&lt;/p&gt;


&lt;p&gt;The most important thing to know is the different status code classes, defined by the first digit of the code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1xx: Informational - Request received, continuing process.&lt;/li&gt;
&lt;li&gt;2xx: Success - The action was successfully received, understood, and accepted.&lt;/li&gt;
&lt;li&gt;3xx: Redirection - Further action must be taken in order to complete the request.&lt;/li&gt;
&lt;li&gt;4xx: Client Error - The request contains bad syntax or cannot be fulfilled.&lt;/li&gt;
&lt;li&gt;5xx: Server Error - The server failed to fulfill an apparently valid request.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some practical direct application of this is when you need to choose between sending back a 404 error and a 500 error. 404 is client's fault. He asked for something that does not exist, and you tell him so. No problem. 500 means that server tried hard to build a response, but something forbid it to achieve its goal. This is a server-side application problem, and you should monitor, and correct this as soon as possible.&lt;/p&gt;


&lt;p&gt;After sending the start line, the response, being a faithful HTTP message, will go on by sending the headers. Like for the request, headers will give informations about the server and the message content. You can consider it as the README file that will help the &lt;strong&gt;user agent&lt;/strong&gt; (http client software) to understand the response.&lt;/p&gt;


&lt;p&gt;Then, the response message will often contain a body (unless you're using some method requiring not to have it), and the most seen cases are either HTML content, XML/JSON (or similar) response that will be treated by a client-side web application (flash, javascript, ...), or binary content (for a file download, for example).&lt;/p&gt;


&lt;h2&gt;HTTP methods&lt;/h2&gt;


&lt;p&gt;What is it? Beside being one word in the request start line, the HTTP method is the client's way to tell the server what kind of operation it wants to perform on the resource requested. The method used in a request have direct implications on what kind of work you can do server-side, and should be choosen carefully (of course, you can break this rule, but it's a very bad idea).&lt;/p&gt;


&lt;h3&gt;Safe methods&lt;/h3&gt;


&lt;p&gt;Some methods are said &quot;safe&quot;. This means that request is a retrieval operation, and should not do any other work. Notice that &quot;should&quot; does not mean &quot;must&quot;, but user cannot be held responsible for breaking something if the method used was &quot;safe&quot;.&lt;/p&gt;


&lt;p&gt;For example, you should not allow GET methods to create, delete or change files, database records, or LDAP nodes (non exhaustive, of course).&lt;/p&gt;


&lt;p&gt;This is the case of GET and HEAD methods.&lt;/p&gt;


&lt;h3&gt;Idempotent methods&lt;/h3&gt;


&lt;p&gt;Idempotents methods are those which won't have any side-effect if repeated more than once.&lt;/p&gt;


&lt;p&gt;For example, the DELETE method, which asks for a resource deletion, should have the exact same effect if it's called only once on resource A, or if it's called ten times. The overall effect should be the resource deletion (if allowed), not less, not more.&lt;/p&gt;


&lt;p&gt;This is the case of GET, HEAD, PUT and DELETE methods.&lt;/p&gt;


&lt;h3&gt;Non-safe and non-idempotent methods&lt;/h3&gt;


&lt;p&gt;But of course, some requests needs to take risky and/or non-repeatable actions server side. When an user agent uses such a method, he will be aware of the risks.&lt;/p&gt;


&lt;p&gt;For example, POST-ing a comment will create a database record, and if you make twice the same request (unless some protection has been developed to prevent this), you will actually create two database records.&lt;/p&gt;


&lt;p&gt;It's the exact reason why browsers ask for user confirmation before repeating a POST request, if user asks for a refresh. It's also the reason why you should redirect to a safe idempotent resource after a successful form submission, to forbid user to be able to repeat request.&lt;/p&gt;


&lt;p&gt;This is the case of POST method.&lt;/p&gt;


&lt;h3&gt;And the real world&lt;/h3&gt;


&lt;p&gt;All those methods are defined by the HTTP RFC, but the real world is much more restricted than that. In fact, modern browsers only support GET and POST methods, so you should only care about those.&lt;/p&gt;


&lt;p&gt;You should just keep in mind that other HTTP methods exist, and for example HTTP extensions like WebDav (which is used by microsoft and their &quot;online folders&quot;) use them. A simple way to try out PUT, DELETE, or any other method is to use curl as an http client.&lt;/p&gt;


&lt;p&gt;To learn more about specificities of all methods, &lt;a href=&quot;http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html&quot; hreflang=&quot;en&quot;&gt;you can still refer to the original RFC&lt;/a&gt;.&lt;/p&gt;


&lt;h3&gt;Example&lt;/h3&gt;


&lt;h4&gt;The request...&lt;/h4&gt;

&lt;pre&gt;
GET /index.html HTTP/1.1
Host: www.example.com
&lt;/pre&gt;


&lt;p&gt;Nothing complicated here, but for curious people (and you should be curious):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;example.com is &lt;a href=&quot;http://www.rfc-editor.org/rfc/rfc2606.txt&quot; hreflang=&quot;en&quot;&gt;a special domain reserved by the RFC 2606&lt;/a&gt;. This domain won't bring any conflict with a real domain, never. You should use it for all your tests and examples.&lt;/li&gt;
&lt;li&gt;The &quot;Host&quot; header is required by HTTP 1.1 protocol, and is used by web servers to provide name based virtual hosting of different websites on the same IP address.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;and the response!&lt;/h4&gt;

&lt;pre&gt;
HTTP/1.1 200 OK
Date: Sun, 24 Jan 2010 22:38:34 GMT
Server: Apache (Boubounetout/Linux)
Last-Modified: Fri, 01 Jan 2010 23:11:55 GMT
Etag: &amp;quot;f3f80-1b6-de1b034b&amp;quot;
Accept-Ranges: bytes
Content-Length: 438
Connection: close
Content-Type: text/html; charset=UTF-8

&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Welcome&amp;lt;/h1&amp;gt;
    &amp;lt;p&amp;gt;Hello, world!&amp;lt;/p&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;


&lt;h2&gt;Conclusion&lt;/h2&gt;


&lt;p&gt;I hope that I'm far from being alone claiming that this is the very basis of any serious web development, and that it will makes your web developer life easier just because you understand the underlying communication language. Yes, HTTP is definitely the web's language, and you should be aware of it.&lt;/p&gt;


&lt;p&gt;Ok folks, this will be all for today. But keep tuned, next episodes are already in the pipes.&lt;/p&gt;


&lt;p&gt;Thanks to &lt;a href=&quot;http://www.funstaff.ch/&quot; hreflang=&quot;en&quot;&gt;Bertrand Zuchuat&lt;/a&gt; for giving feedback and ideas before the article publication.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>sfDynamicsPlugin towards 1.0 release</title>
    <link>http://www.symforc.com/post/2009/12/16/sfDynamicsPlugin-towards-10-release</link>
    <guid isPermaLink="false">urn:md5:2c0d8a15a35c420ac77ac5ef28139f93</guid>
    <pubDate>Wed, 16 Dec 2009 23:45:00 +0100</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>release</category>
        <category>dynamics</category><category>javascript</category><category>plugin</category><category>release</category><category>symfony</category>    
    <description>    &lt;p&gt;It's been quite a while since the last big update, and after today's one, I decided to release 0.9.6 version (0.9.5 did not have symfony 1.4 support advertised in package.xml, so I created a new one for this).&lt;/p&gt;


&lt;p&gt;Little sum up of new features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Symfony cache is now used in debug mode too, but it checks assets modification timestamps to know if a recompilation is needed. This timestamp check is not done in non-debug mode, to avoid overhead.&lt;/li&gt;
&lt;li&gt;An asset filter chain, fully configurable, extensible and backward compatible is now there. The process is pretty simple: you can write subclasses of &lt;em&gt;sfDynamicsBaseAssetFilter&lt;/em&gt; to implement your last great idea about assets filtering. Then, just register it in your app.yml under the section &lt;em&gt;sfDynamicsPlugin/concatenated_javascript_filter_chain&lt;/em&gt; (or the same with stylesheet). A full working example is available on the new &lt;a href=&quot;http://dynamics.dakrazy.net/documentation/configuration-application_configuration&quot; hreflang=&quot;en&quot;&gt;application configuration&lt;/a&gt; page, that describe all app.yml configuration directives. By the way, the default asset filtair chain is exactly the same as before.&lt;/li&gt;
&lt;li&gt;To demonstrate this new feature, a &lt;em&gt;sfDynamicsExperimentalClosureAPIJavascriptFilter&lt;/em&gt; class has been added. It is an asset filter that calls the Google Closure Compiler API, via an HTTP POST request. Of course, it is not a good idea to do so on a «real» website, but this class is here for demonstration purpose.&lt;/li&gt;
&lt;li&gt;Along with the new documentation page, a set of configuration values that were guessed depending on if you are in debug mode, or not, are now  configurable via the app.yml of each applications. Of course, the default value is fully backward compatible.&lt;/li&gt;
&lt;li&gt;Last feature, which is more polishing than a feature, is that your project won't show up if the sfDynamics module is disabled but required for some assets. Instead, an exception will explain what's missing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All those features are tested since a few weeks, and a simple cache:clear after upgrading the plugin should keep your project in a nice state. Or at least, I hope so...&lt;/p&gt;


&lt;p&gt;The global goal of this release is to tend towards 1.0, by making all existing features configurable and extensible, so that 1.0 branch will be able to remain stable and 100% backward compatible for a long time.&lt;/p&gt;


&lt;p&gt;See you space symfonists!&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>All about backward compatibility...</title>
    <link>http://www.symforc.com/post/2009/09/23/All-about-backward-compatibility</link>
    <guid isPermaLink="false">urn:md5:66ad6d63e789cfcc308a020b9c0c05c2</guid>
    <pubDate>Wed, 23 Sep 2009 23:30:00 +0200</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>discussion</category>
        <category>autoload</category><category>bc</category><category>php</category><category>quality</category><category>regression</category><category>symfony</category>    
    <description>&lt;p&gt;Backward compatibility sounds nice, but it's not so easy to respect it in big projects. And the whole interest &lt;ins&gt;is&lt;/ins&gt; on big projects: it's maybe not such a problem if your grand-ma's blog breaks its API on each release, but there would be a revolution (or not?) if win32 API was changing on each &lt;del&gt;enslavement&lt;/del&gt; service pack microsoft releases.&lt;/p&gt;


&lt;p&gt;Here is a real story case study of a BC break that happened on the PHP language itself.&lt;/p&gt;    &lt;p&gt;It's always tempting to say «hey, this feature is so great, and has so little impact on the way it works, it may be cool to include it it the stable branch, don't you think?». Well, it can be cool, if it cannot have any effect on existing projects. But let's think again. How can it have no effect on the existing projects? And if it has no effect, why include it in this branch?&lt;/p&gt;


&lt;p&gt;I don't think there is a definite answer to this, as it &lt;ins&gt;may&lt;/ins&gt; have pros sometimes. But most of the time, it will have much more cons than pros. And if you doubt, forget it. Bigger is the project you work in, more it will have users depending on it, and if there is any way users could have used the old &quot;buggy&quot; feature, for sure they did.&lt;/p&gt;


&lt;p&gt;I want to expose some real life case that happened recently, on the PHP distribution itself, showing its snowball effect through symfony to real life projects.&lt;/p&gt;


&lt;p&gt;Let's have a look at &lt;a href=&quot;http://bugs.php.net/44144&quot; hreflang=&quot;en&quot;&gt;this php bug report&lt;/a&gt;. It says «spl_autoload_functions() should return object instances, not class
names, when appropriate.»&lt;/p&gt;


&lt;p&gt;Two words are really interesting in this bug report. It is &quot;should&quot; and &quot;when appropriate&quot;. There is many assumptions behind this. When is this &quot;appropriate&quot;? Why &quot;should&quot; it return instances? I would better rephrase it as «Feature request: spl_autoload_functions() must return object instances, as it is more appropriate than strings containing class names.». The overall formulation is not so much important as the facts that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;it is a feature request, not a bug&lt;/li&gt;
&lt;li&gt;the function is currently working, but its behaviour can be changed to a more convenient one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But it's ok, right? The target version was 5.3 while still no stable releases existed.&lt;/p&gt;


&lt;p&gt;Yes it is.&lt;/p&gt;


&lt;p&gt;Oh wait, let's read the comments now.&lt;/p&gt;


&lt;p&gt;«Thanks for the fix. Do you think, by any chance, we can sneak this into PHP 5.2, or is that impossible?»&lt;/p&gt;


&lt;p&gt;The definite answer to this question should be «It is actually impossible. Introducing a behavior change into 5.2 (years) stable release would break backward compatibility.»&lt;/p&gt;


&lt;p&gt;And the patch made it to PHP 5.2.11.&lt;/p&gt;


&lt;p&gt;Is there any consequences? Yes of course. In fact any symfony 1.3 projects were broken at this stage, because symfony used this behaviour with the reintroduced sfAutoloadAgain autoloader, which checked the return value for strings, and got instances, causing an infinite loop that made apache segmentation fault.&lt;/p&gt;


&lt;p&gt;This is now fixed, by &lt;a href=&quot;http://trac.symfony-project.org/changeset/22248&quot; title=&quot;http://trac.symfony-project.org/changeset/22248&quot;&gt;http://trac.symfony-project.org/cha...&lt;/a&gt;, but was the feature worth the hassle? How many projects can this kind of change break?&lt;/p&gt;


&lt;p&gt;So for all you that work on big projects, think well, then think again, then don't do such a change. Usual formula says «With great power comes great responsibilities». I'd add «Great notoriety induce great responsibilities».&lt;/p&gt;


&lt;p&gt;Yes millions of people uses PHP, and that's the main reason why stable branch should stay stable. Rock solid stable.
And it's the same reason why symfony branches stay stable, as much as possible. And any exception to this always have bad feedback.&lt;/p&gt;


&lt;p&gt;(thanks to &lt;a href=&quot;http://blog.thepimp.net/&quot;&gt;Pierre Joye&lt;/a&gt; for his reminder at &lt;a href=&quot;http://news.php.net/php.internals/45628&quot; title=&quot;http://news.php.net/php.internals/45628&quot;&gt;http://news.php.net/php.internals/4...&lt;/a&gt;)&lt;/p&gt;


&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note&lt;/strong&gt;: Software stability does not only mean bug-free. It also means «not changing», and it's the main definition used there. Bugs are annoying, but they can be fixed to get the wanted behavior back, so it's not a problem. And the only wanted behavior of a stable piece of software is the behavior it always had.&lt;/em&gt;&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Some sfDynamics news...</title>
    <link>http://www.symforc.com/post/2009/09/20/Some-sfDynamics-news</link>
    <guid isPermaLink="false">urn:md5:53361f40c5771f4a3941ba3a3de75067</guid>
    <pubDate>Sun, 20 Sep 2009 23:30:00 +0200</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>plugin</category>
        <category>plugin</category><category>release</category><category>roadmap</category><category>sfDynamics</category><category>trackeet</category>    
    <description>    &lt;p&gt;Long time no see...&lt;/p&gt;


&lt;p&gt;I'm very happy to get more and more comments and feedback about sfDynamics. I sure know it's not perfect, but seeing it's really usefull for other people than me and my colleagues is rewarding.&lt;/p&gt;


&lt;p&gt;But I've also been so busy lately that I did very few writing and coding work around it, so I'll write about last months work, and about the future road-map.&lt;/p&gt;

&lt;pre&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;I moved all my plug-ins ticketing from their different homes (lighthouse for sfDynamics, and symfony-project's trac for the others) to a brand new redmine instance I set up on &lt;a href=&quot;http://trackeet.org/&quot;&gt;trackeet.org&lt;/a&gt;. This will greatly enhance how I can see the issue list, prioritize and assign different stuff to people willing to help. Additionally, it helps cleaning up symfony-project's trac instance which suffers from plug-in issues since a long time.&lt;/li&gt;
&lt;li&gt;I fixed the easiest issues, and they're packaged into the 0.9.4 release.&lt;/li&gt;
&lt;li&gt;Since 0.9.2 release, we don't support anymore symfony 1.1, as the routing system was radically different and way less power-full.&lt;/li&gt;
&lt;li&gt;After I released 0.9.4 this week, next step will be a documentation clean-up, and some tutorial writing. Yes, the fourth part is still missing, and it will come to life very soon.&lt;/li&gt;
&lt;li&gt;Upcoming 1.0 release will support symfony 1.2, 1.3, and 1.4. The aim for this release is to fix all 0.9 tickets that are not radically new features. A refactoring session before the first 1.0 release will be planned.&lt;/li&gt;
&lt;li&gt;Next 1.1 version will at least support symfony 1.4, and if it's possible 1.2 and 1.3 too. But the main goal will be to stick to the next LTS symfony version, which will be 1.4.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I know, no dates were given on this page, but the new &lt;a href=&quot;http://trackeet.net/projects/roadmap/sf-dynamics-plugin&quot; hreflang=&quot;fr&quot;&gt;roadmap page&lt;/a&gt; solves this.&lt;/p&gt;


&lt;p&gt;Some more news soon...&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dynamics.dakrazy.net/&quot; hreflang=&quot;en&quot;&gt;sfDynamics homepage &amp;amp; documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://trackeet.net/projects/sf-dynamics-plugin/issues&quot; hreflang=&quot;en&quot;&gt;sfDynamics issues&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>The first sfDynamicsPlugin beta is out!</title>
    <link>http://www.symforc.com/post/2009/04/06/The-first-sfDynamicsPlugin-beta-is-out</link>
    <guid isPermaLink="false">urn:md5:9b7d921cfab1f2148d2172043097bf43</guid>
    <pubDate>Mon, 06 Apr 2009 23:48:00 +0200</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>release</category>
        <category>annoucement</category><category>assets</category><category>css</category><category>js</category><category>performance</category><category>plugin</category><category>xml</category>    
    <description>&lt;p&gt;After a long alpha development stage, I released this morning the first BETA
version of sfDynamicsPlugin. But... You may wonder, what is that?&lt;/p&gt;


&lt;p&gt;sfDynamicsPlugin is a flexible assets manager for symfony which can be used to
manage javascript libraries and their associated stylesheets. It supports
packing, and CSS minifying, while keeping the full readable source in development
environment.&lt;/p&gt;    &lt;h2&gt;Finally out&lt;/h2&gt;


&lt;p&gt;After more than one year of thinkings about the right way to manage
dependencies and relations between dynamic components, and a few months of
intermitent coding, I'm proud to present sfDynamicsPlugin.&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://www.symfony-project.org/plugins/sfDynamicsPlugin&quot; hreflang=&quot;en&quot;&gt;Look at the plugin's page at symfony project&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;Features at a glance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JS framework agnostic&lt;/li&gt;
&lt;li&gt;Built-in assets cache/supercache&lt;/li&gt;
&lt;li&gt;Flexible XML configuration of packages&lt;/li&gt;
&lt;li&gt;Dependencies/conflict management&lt;/li&gt;
&lt;li&gt;Ease of use within plugins without repeating JS code&lt;/li&gt;
&lt;li&gt;Built-in configuration for the most used frameworks including jQuery, jQuery UI, ExtJS, Prototype and Scriptaculous.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Use what you like&lt;/h2&gt;


&lt;p&gt;To give some more details about the last feature, those are bundled as
non-default configuration files, that you may, if you want, import in your
project/app/plugin dynamics configuration file.&lt;/p&gt;


&lt;p&gt;By doing so, there is absolutely no parsing overhead, as unused configuration
files will be, he, unused.&lt;/p&gt;


&lt;h2&gt;Documentation, documentation and even more documentation!&lt;/h2&gt;


&lt;p&gt;As documentation is very important, full documentation is available both in
markdown and HTML versions, along with a
&lt;a href=&quot;http://dynamics.dakrazy.net/documentation/tutorial-01_getting_started&quot; hreflang=&quot;en&quot;&gt;tutorial&lt;/a&gt;
and a &lt;a href=&quot;http://dynamics.dakrazy.net/example/jquery/000-hello-world&quot; hreflang=&quot;en&quot;&gt;short hello world&lt;/a&gt; example.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dynamics.dakrazy.net/documentation/tutorial-01_getting_started&quot; hreflang=&quot;en&quot;&gt;Give me the tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dynamics.dakrazy.net/&quot; hreflang=&quot;en&quot;&gt;Take a look at the full HTML documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://github.com/hartym/sfdynamicsplugin/tree/30e524b3a7a711ee3dbd3460001e10d9f3c15b29/doc&quot; hreflang=&quot;en&quot;&gt;I'm a warrior, give me the MarkDown&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Reporting bugs, suggesting features&lt;/h2&gt;


&lt;p&gt;We use &lt;a href=&quot;http://dynamics.lighthouseapp.com/dashboard&quot; hreflang=&quot;en&quot;&gt;lighthouseapp as our ticketing system&lt;/a&gt;.
Don't hesitate to report bugs, we're looking forward to make this plugin a
«YFast» answer to highly dynamic websites.&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://dynamics.lighthouseapp.com/dashboard&quot; hreflang=&quot;en&quot;&gt;Ok, show me the issues...&lt;/a&gt;&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>How to render a component in an action with symfony 1.1+</title>
    <link>http://www.symforc.com/post/2009/03/12/How-to-render-a-component-in-an-action-with-symfony-11</link>
    <guid isPermaLink="false">urn:md5:8f937106a5989410ef4cdbf57abc11f2</guid>
    <pubDate>Thu, 12 Mar 2009 13:34:00 +0100</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>discussion</category>
        <category>action</category><category>component</category><category>render</category><category>symfony</category>    
    <description>    &lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;public &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; executeBarfoo&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;sfWebRequest &lt;span style=&quot;color: #0000ff;&quot;&gt;$request&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;return&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;renderComponent&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_module'&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;'my_component'&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;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;


&lt;p&gt;This is an attempt to take over the first place on google for the query how to render component action symfony.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Foreign key's onDelete for dummies</title>
    <link>http://www.symforc.com/post/2008/07/10/Foreign-keys-onDelete-for-dummies</link>
    <guid isPermaLink="false">urn:md5:2e49ed06a0bba3a3d2459d21260ff73d</guid>
    <pubDate>Thu, 10 Jul 2008 23:55:00 +0200</pubDate>
    <dc:creator>Romain Dorgueil</dc:creator>
        <category>database</category>
        <category>database</category><category>doctrine</category><category>model</category><category>orm</category><category>propel</category>    
    <description>&lt;p&gt;Any modern relational database engine supports the onDelete and onUpdate attributes on foreign keys. Propel and Doctrine of
course allows to define it in the schema file (yaml or xml) and I believe it is important to explicitly set it.&lt;/p&gt;    &lt;h2&gt;Restrict mode&lt;/h2&gt;


&lt;p&gt;«Better do nothing than something stupid.»&lt;/p&gt;


&lt;p&gt;The default behaviour is &lt;em&gt;ON DELETE RESTRICT&lt;/em&gt;. This is the most secure setting, so it is normal to have it as default.&lt;/p&gt;


&lt;p&gt;If we try to &lt;em&gt;DELETE&lt;/em&gt; a record referenced by the current object, the database engine just raise an SQL error. If it was not
an error to &lt;em&gt;DELETE&lt;/em&gt; this, you will have to start by removing the linked object, or setting the foreign key value to something different.&lt;/p&gt;


&lt;h2&gt;Cascade mode&lt;/h2&gt;


&lt;p&gt;«No need to keep obsolete things.»&lt;/p&gt;


&lt;p&gt;But our database engines are able to do better. For example, if you have an user's settings table and you delete an user, you may not wan't
to keep his settings. You just set &lt;em&gt;ON DELETE CASCADE&lt;/em&gt; on user's setting foreign key column referencing the user table, and if a user is ever deleted, all his associated properties will be destroyed.&lt;/p&gt;


&lt;p&gt;Along with &lt;em&gt;ON DELETE CASCADE&lt;/em&gt;, we usually add a NOT NULL constraint (or required: true), as the existence of current object is directly
related to the existence of linked object. This may be wrong from time to time, but it is usually the case.&lt;/p&gt;


&lt;h2&gt;Set null mode&lt;/h2&gt;


&lt;p&gt;«We don't rely on this. Just forget it.»&lt;/p&gt;


&lt;p&gt;The last behavior is the &lt;em&gt;ON DELETE SET NULL&lt;/em&gt; option. It does exactly what it says. If linked object is removed, we set our foreign key
value to null.&lt;/p&gt;


&lt;p&gt;This the behavior you may want to use for articles having a link to their author for example. If the author is removed from database,
we don't want to delete his articles, so we just loose the author information (well ok, this is a simplification, but it basically shows
the idea).&lt;/p&gt;


&lt;h2&gt;Why I think we should explicitly use it&lt;/h2&gt;


&lt;p&gt;The default database engine behavior is «I don't know how to handle it». Setting it will add power to your database model, while taking
profit of your RDBMS features. Not setting it is like saying «I don't know which way I want my database to behave in case we delete a linked
object», and that's like saying «I don't know how I want my model to react». Thinking a little to understand which way you want it to work
will make you certain you're understanding the behavior you need in your project.&lt;/p&gt;


&lt;h2&gt;How to set it in your favorite ORM:&lt;/h2&gt;


&lt;h3&gt;schema.yml with Doctrine&lt;/h3&gt;

&lt;pre&gt;
Article:
  columns:
    title:   string(255)
    body:    string(4096)
    user_id: integer(4)
  relations:
    User:
      onDelete: CASCADE
&lt;/pre&gt;


&lt;h3&gt;PHP model with Doctrine&lt;/h3&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;php&quot;&gt;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;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;hasOne&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'&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;'local'&lt;/span&gt;&amp;nbsp; &amp;nbsp; =&amp;gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'user_id'&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff0000;&quot;&gt;'foreign'&lt;/span&gt;&amp;nbsp; =&amp;gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'id'&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #ff0000;&quot;&gt;'onDelete'&lt;/span&gt; =&amp;gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'CASCADE'&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;#125;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;


&lt;h3&gt;schema.yml with Propel&lt;/h3&gt;

&lt;pre&gt;
    data_id:  { type: integer, primaryKey: true, foreignTable: data, foreignReference: id, onDelete: cascade, onUpdate: cascade }
&lt;/pre&gt;


&lt;h3&gt;schema.xml with Propel&lt;/h3&gt;

&lt;div class=&quot;code&quot;&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;foreign&lt;/span&gt;-key &lt;span style=&quot;color: #000066;&quot;&gt;foreignTable&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;data&amp;quot;&lt;/span&gt; onDelete = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;setnull&amp;quot;&lt;/span&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;reference&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;local&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;data_id&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;foreign&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;id&amp;quot;&lt;/span&gt; &lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;/foreign&lt;/span&gt;-key&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;</description>
    
    
    
      </item>
    
  <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>
    
    
    
      </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>
    
    
    
      </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>
    
    
    
      </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>
    
    
    
      </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>
    
    
    
      </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>
    
    
    
      </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>
    
    
    
      </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>
    
    
    
      </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>
    
    
    
      </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>
    
    
    
      </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://www.doctrine-project.org/documentation/manual/1_0/en/configuration#portability&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>
    
    
    
      </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>
    
    
    
      </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>
    
    
    
      </item>
    
</channel>
</rss>