DB_DataObject_FormBuilder

From: Date: Tue, 02 Mar 2004 22:46:55 +0000
Subject: DB_DataObject_FormBuilder
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-11062@lists.php.net to get a copy of this message
I have been experiementing with DB_Object_FormBuilder because I wanted to take advantage of the automatic form building based on table structure, and to explore the feature of related tables (Where one tables primary key is a related key in another table) where the form builder creates dropdown menus to the related tables. At first this did not work at all, then I downloaded the example from the CVS and looked into the forbuilder.ini file and found out that the values did not match the ones i had i my ini file. The example way is that each collumn not being an id collumn have the value one, all the others the value two. In my file (created by the createTable.php and my db_object.ini file), the valuse where something entirely different. for example the tablename_keys properties always had a value "N" Anyhow, after changing my tablename.ini to only containing the numbers 1 and 2, the dropdown function started to work. Worth mentioning is that i also copied the schema.sql from the CVS and imitated this style of creating tables. Does anyone know whether this: CONSTRAINT PK_company PRIMARY KEY (company_id),
    UNIQUE KEY IDX_company_1(company_id)
is required and what it does... I attach my schema.sql, tablename.ini and tablename.links.ini below so you better see my structure. David Thunman /***** * schema.sql ********/ CREATE TABLE person (
    person_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    company_ID INTEGER UNSIGNED NOT NULL,
    firstname VARCHAR(96) NOT NULL,
    lastname VARCHAR(96) NOT NULL,
    email VARCHAR(96) NOT NULL,
    info TEXT,
    CONSTRAINT PK_person PRIMARY KEY (person_id),
    KEY IDX_person_1(company_ID)
); CREATE TABLE company (
    company_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    name VARCHAR(255) NOT NULL,
    street VARCHAR(255) NOT NULL,
    zip VARCHAR(255) NOT NULL,
    city VARCHAR(255) NOT NULL,
    country VARCHAR(255) NOT NULL,
    CONSTRAINT PK_company PRIMARY KEY (company_id),
    UNIQUE KEY IDX_company_1(company_id)
); /***** * tablename.ini ********/ [company] company_id = 1 name = 2 street = 2 zip = 2 city = 2 country = 2 [company__keys] company_id = 1 [person] person_id = 1 company_ID = 1 firstname = 2 lastname = 2 email = 2 info = 2 [person__keys] person_id = 1 /***** * tablename.links.ini ********/ ; This file defines relations between your tables. This is needed for ; automatic combobox building, auto-joins and more. Always keep it up-to-date. ; Format is pretty straightforward: ; [tablename] ; fieldname = targetTableName:targetFieldName [person] company_ID = company:company_id

« previous php.pear.general (#11062) next »