[Solar-talk] Solar_Sql_Table

Rodrigo Moraes rodrigo.moraes at gmail.com
Thu Oct 4 04:15:05 CDT 2007


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


More information about the Solar-talk mailing list