[Solar-talk] Solar_Sql_Table

Kilbride, James P. James.Kilbride at gd-ais.com
Thu Oct 4 06:53:37 CDT 2007


That's.... unfortunate.

What's the time line for the release of the ORM branch? While I can use
solar as is now I'm not going to be having it do any form of table
generation if it can't be dynamically assigned to recognize my own table
interactions. Also, id.. Internally to sql_table it seems to be the
assumed primary key. Am I missing something in the code of that? or does
the sql_table class always assume there is a column called id which is
the primary key/unique identifier for the table?

James Kilbride 

-----Original Message-----
From: solar-talk-bounces at lists.solarphp.com
[mailto:solar-talk-bounces at lists.solarphp.com] On Behalf Of Rodrigo
Moraes
Sent: Thursday, October 04, 2007 5:15 AM
To: solar-talk at lists.solarphp.com
Subject: Re: [Solar-talk] Solar_Sql_Table

On 10/3/07, Kilbride, James P. wrote:
> Since the class/package data doesn't mention it, looking at 
> Solar_Model_Node I see the schema code. Is there something which 
> defines what a column's fields are and what they mean?

I think they are only documented in the API reference (see below).

> In particular what does 'valid' => 'word'
> mean?

This is related to validation. Before saving, the table will call
Solar_Valid and the method validateWord(). 'valid' can be a a string or
an array of validations to perform. Possible ones are in Solar_Valid
class (which you can extend and add your own validations if needed).

> For indexs 'type' => 'unique' seems pretty clear. If it's a primary 
> key do I say 'primary key'?

There is some documentation in the API reference for
Solar_Sql_Table::$_col. Here are the possibilities:

     *     $col = array(
     *         'col_name' => array(
     *             'name'    => (string) the col_name, same as the key
     *             'type'    => (string) char, varchar, date, etc
     *             'size'    => (int) column size
     *             'scope'   => (int) decimal places
     *             'valid'   => (array) Solar_Valid methods and args
     *             'require' => (bool) is this a required (non-null)
column?
     *             'autoinc' => (bool) auto-increment
     *             'default' => (string|array) default value
     *             'primary' => (bool) is this part of the primary key?
     *          ),
     *     );

>What about foreign keys? How do I define a  column as being foreign 
>keyed to another table? How does solar know(if it  does)?

It is not possible to define relationships in Solar_Sql_Table. This is
one of the purposes of the ORM system which is under development in the
orm branch. In trunk, there is Solar_Sql_Model, but given the changes
that will come with the new stuff, you should ignore it for now.

cheers,
rodrigo
_______________________________________________
Solar-talk mailing list
Solar-talk at lists.solarphp.com
http://mailman-mail3.webfaction.com/listinfo/solar-talk



More information about the Solar-talk mailing list