[Solar-talk] The best yet!

Paul M Jones pmjones at solarphp.com
Tue Jun 27 12:37:27 PDT 2006


On Jun 27, 2006, at 2:17 PM, Jeff Surgeson wrote:

> When I first saw all the BC breaks again I cried and called you a  
> few names

I know, I know.  :-(  You were the first one on my mind every time I  
broke something.  I wanted to make sure that every broken thing would  
end up being easier afterwards.  So I am really really sorry for  
causing you pain and suffering ...


> however, I dont know if it is my imagination or the fact that I  
> having been
> using Solar for a while and might actualy be learning something but  
> this
> latest release works like a dream and is as smooth as whipped cream!

... but as you can see it turns out to be worth it.  :-)


> Some of my code and ideas that just did not work for me before are  
> just
> falling into place, the method based actions are great! the Mysql  
> database
> stuff is awesome! everything is just becoming a really great  
> universal set of
> tools.
>
> Paul take a bow, great stuff!

Dude, seriously, thank you so much.  That's the stuff that keeps me  
going.  :-)

Just wait until you see the new Solar_Sql_Row and _Rowset code.  
You'll be able to call things like...

     $list = $table->fetchAll($where, $order, $page);
     foreach ($list as $row) {
         echo $row->col_name; // object notation
     }

     $item = $table->fetch($id);
     $item->col_name = 'update me';
     $item->save();  // updates existing row and refreshes values

     $new = $table->fetchDefault();
     $new->col_name = 'insert me';
     $new->save(); // inserts row and updates id, created, updated, etc

This combination of Row Data Gateway and Table Module patterns makes  
for a decent "formal" Active Record pattern (although nowhere near as  
cool as the Rails ActiveRecord class, which strictly speaking is more  
a Domain Model kind of thing).

Once nice thing about this is that the new classes work both as an  
object as an array:  $row['id'] and $row->id are identical.  You can  
foreach() through them, check if they are empty(), count() them, etc.  
This means that existing code does not need to be rewritten for the  
new classes.

Also, you can tie the Row and Rowset save() methods to any object  
that has a save() method, whether a Solar_Sql_Table object, or a  
Solar_Content object, or anything else.  There's a speed tradeoff for  
this ease of use, but I think it's very much worth it.

For more info, see today's SVN commits:

     http://solarphp.com/svn/trunk/Solar/Struct.php
     http://solarphp.com/svn/trunk/Solar/Sql/Row.php
     http://solarphp.com/svn/trunk/Solar/Sql/Rowset.php

Look for them in the next release.



--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.   <http://solarphp.com>

Savant: The simple, elegant, and powerful solution for
templates in PHP.   <http://phpsavant.com>




More information about the solar-talk mailing list