[Solar-talk] Solar_Sql_Table initial rows
Paul M Jones
pmjones at solarphp.com
Tue Jul 11 13:25:02 PDT 2006
On Jul 11, 2006, at 1:04 PM, Antti Holvikari wrote:
> I need it for inserting a row to my users table. I know, I need to
> think it security-wise, but I really need to get that first user to
> the table somehow. Also, I've seen a few projects that need some data
> in the tables to work properly. One example would be a blog app which
> would insert a "Welcome to your blog!" entry into the entrys table.
If you're using the PEAR installer, there is a post-install hook you
can run. Here's a place to start ...
http://greg.chiaraquartet.net/archives/5-Post-install-Scripts-in-
PEAR-1.4.0.html
... but that may not be the right thing for you.
> I could override _autoCreate but it isn't that convenient, checking
> for that bool from the parent. Maybe a new method is what we need?
You're probably right. _postCreate() perhaps?
Having said that, I think that Solar_Sql_Table is due for refactoring
again; the internal validations, etc. need some work (as Jeff
Surgeson will attest), and the _autoCreate()/_autoSetup() could
certainly be more intuitive code-wise. I'm thinking that S_S_Table
needs to be a bit more stripped-down to a generic case, and then have
a new Solar_Model class that adds on top of it. That lets other
vendors (like you) pick their level of functionality (generic Table
or more full-featured Model), and then build on it. (Does that make
sense?)
--
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