<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>H3RALD: rdBaker: Bake your CakePHP application online</title>
    <link>http://www.h3rald.com/blog/27</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Fabio Cevasco's Writings</description>
    <item>
      <title>rdBaker: Bake your CakePHP application online</title>
      <description>&lt;p&gt;Right after my &lt;a href="http://www.h3rald.com/blog/view/26"&gt;last blog post&lt;/a&gt; I decided to log on #cakephp on irc.freenode.org as usual, and gwoo pops in and says &amp;#8220;h3raLd, you didn&amp;#8217;t review rdBaker yet!&amp;#8221; 
That&amp;#8217;s right, I didn&amp;#8217;t yet, so I may as well do it today.&lt;/p&gt;


	&lt;p&gt;I remember hearing about rdBaker months ago, waaay before CakePHP 1.0, way before the RCs, I remember someone mentioning it on CakePHP user group in right after the bake.php script was created. &lt;em&gt;&amp;#8220;How about having an online baking utility?&amp;#8221;&lt;/em&gt; &amp;#8211; and that&amp;#8217;s precisely what rdBaker is, a more &lt;span class="caps"&gt;PHP&lt;/span&gt;-ish version of bake.php, which runs like any other &lt;span class="caps"&gt;PHP&lt;/span&gt; scripts: in your browser.&lt;/p&gt;


	&lt;p&gt;This cute little thing is obviously available for free on &lt;a href="http://cakeforge.org/frs/?group_id=13&amp;#38;release_id=74"&gt;CakeForge&lt;/a&gt; and is part of &lt;a href="http://www.rd11.com"&gt;gwoo&lt;/a&gt; &amp;#8217;s &lt;a href="http://cakeforge.org/projects/rdos/"&gt;rdOpenSource&lt;/a&gt; project which includes various other Cake-powered applications.
I personally recommend new (and old) bakers to download them and play with them, try to understand how they were coded, because they can really teach you &lt;em&gt;a lot&lt;/em&gt; on how to code a CakePHP application or website properly.&lt;/p&gt;


	&lt;p&gt;So anyway, get your copy of rdBaker, unzip it and have a look at the &lt;code&gt;README.txt&lt;/code&gt; file for the installation instructions:&lt;/p&gt;


&lt;quote&gt;
1. Place rdBaker in the root along side /cake_install/app.
2. chmod /cake_install/rdBaker/tmp to 0777
3. launch http://localhost/cake_install/rdBaker/
&lt;/quote&gt;

	&lt;p&gt;Not too hard, innit?&lt;/p&gt;


	&lt;p&gt;&lt;img src="http://www.h3rald.com/img/pictures/rdbaker.jpg" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;Good. So you try accessing something like &lt;code&gt;http://localhost/php/test/cakephp/cake_test/rdBaker/&lt;/code&gt; (that&amp;#8217;s on my own local &lt;span class="caps"&gt;WAMP&lt;/span&gt; server) and you&amp;#8217;ll get a nice page asking you to &amp;#8220;supply your ingredients&amp;#8221; via a simple form. 
Unlike its command line cousin, rdBaker doesn&amp;#8217;t require you to fill in &lt;em&gt;all&lt;/em&gt; the fields, but just the full path to the save directory (which is normally already filled in) and of course the name of the model (Post, User, Comment).
Then you can select the type of output and choose whether you want to generate an empty controller, a scaffolded one or the &lt;em&gt;full&lt;/em&gt; option including all the most common &lt;acronym title="Create, Retrieve, Update, Delete"&gt;CRUD&lt;/acronym&gt; methods.
Finally &amp;#8211; if you like &amp;#8211; you can enter any association or valitation rules for your model, then press the &lt;em&gt;Bake it!&lt;/em&gt; button and voil&amp;aacute;, in you&amp;#8217;ll find three directories (controllers, models and views) in your save directory containing all the &lt;acronym title="Model View Controller"&gt;MVC&lt;/acronym&gt; entities you need regarding a particular model:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
        rdBaker Result Array
(
    [0] =&amp;gt; notes_controller.php created and written. Look in D:SERVERwwwphptestcakephpcake_testtmpcontrollers
    [1] =&amp;gt; note.php created and written. Look in D:SERVERwwwphptestcakephpcake_testtmpmodels
    [2] =&amp;gt; index.thtml created and written. Look in D:SERVERwwwphptestcakephpcake_testtmpviews/notes
    [3] =&amp;gt; add.thtml created and written. Look in D:SERVERwwwphptestcakephpcake_testtmpviews/notes
    [4] =&amp;gt; edit.thtml created and written. Look in D:SERVERwwwphptestcakephpcake_testtmpviews/notes
    [5] =&amp;gt; view.thtml created and written. Look in D:SERVERwwwphptestcakephpcake_testtmpviews/notes
)
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;But there&amp;#8217;s more! By checking the appropriate checkbox, you can get all the stuff packed in a zip file!&lt;/p&gt;


	&lt;p&gt;Not bad at all, and fast as well.&lt;/p&gt;


	&lt;p&gt;Now the bad things&amp;#8230;
The script works fine, but there&amp;#8217;s something which could be improved, perhaps:&lt;/p&gt;


* If you choose to put everything in a zip file, the file will be named &amp;#8220;baked_by_rdBaker.zip&amp;#8221; &amp;#8211; not a big deal, but maybe it could be personalized according to the model name entered.
* Regardless you want to add validation rules to your model or not, you&amp;#8217;ll &lt;em&gt;always&lt;/em&gt; find some validation rules for a &lt;em&gt;title&lt;/em&gt; and &lt;em&gt;body&lt;/em&gt; field. I checked and they are hardcoded in the template file (rdBaker/views/helpers/templates/full/model.txt):
&lt;pre&gt;&lt;code&gt;
  var $validate = array(
        'title'=&amp;gt;VALID_NOT_EMPTY,
        'body'=&amp;gt;VALID_NOT_EMPTY);
&lt;/code&gt;&lt;/pre&gt;
* In the baked index.thtml view, there will always be a column named &amp;#8220;Title&amp;#8221;. This, again, is hardcoded in the template.

	&lt;p&gt;Other than these things, everything seems to work fine. A really nice script!&lt;/p&gt;</description>
      <pubDate>Mon, 08 May 2006 11:50:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:aadfe14f-5d09-102a-8a4a-e48c0fa51268</guid>
      <author>Fabio Cevasco</author>
      <link>http://www.h3rald.com/blog/27</link>
      <category>Blog</category>
      <category>CakePHP</category>
      <trackback:ping>http://www.h3rald.com/trackback/entries/26</trackback:ping>
    </item>
  </channel>
</rss>
