Re: Package proposal: DataObjectOnSpeed (naming is discussable :-))

From: Date: Thu, 24 Jul 2003 16:12:35 +0000
Subject: Re: Package proposal: DataObjectOnSpeed (naming is discussable :-))
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-18632@lists.php.net to get a copy of this message
you get my +5 .., err +1 Yavor ----- Original Message ----- From: "Markus Wolff" <wolff@21st.de> To: <pear-dev@lists.php.net> Sent: Wednesday, July 23, 2003 2:17 AM Subject: [PEAR-DEV] Package proposal: DataObjectOnSpeed (naming is discussable :-)) Hey guys, as mentioned a few days ago, I´ve written a class that acts as a bridge between DB_DataObject and HTML_QuickForm, which makes it very suitable for rapid prototyping of applications. - It can auto-generate fully functional forms out of your DataObject-derived classes. - It will try to auto-detect the field types and choose appropriate form element types for them. As this sometimes is not possible out- of-the-box, this can be influenced by setting some new config properties in your classes. - It will try to set up some *very* basic validation rules based on the field´s datatype. If you need to add to or alter these rules, you can do so after auto-generation. - It will automatically follow table relations to build select boxes (if the links.ini file is correctly configured). - It allows you to start out prototyping quickly using generated forms and then customizing the form elements step-by-step until you´re satisfied with the outcome. You can mix user-defined element definitions with auto-generated ones, so you only need to do the minimum amount of neccessary work (yes, I am lazy - that´s why I´ve written this ;-)) - It provides a standard method for processing incoming form data and for automatically performing an insert or update on the database with that new data. - It can not yet make coffee :-((( The code can be seen here: http://projects.21st-hq.de/DataObjectOnSpeed.phps When using this class, making a form *and* performing the appropriate insert or update operations for some table data looks as simple as this: include_once('DataObjects/Customers.php'); $cust = &new Customers; if (isset($_GET['customer_id'])) { $cust->get($_GET['customer_id']); } $form = $cust->getForm($_SERVER['PHP_SELF']); if ($form->validate()) { $form->freeze(); // This will automagically insert or update the data $form->process(array(&$cust,'processForm'), false); } $form->display(); That´s all. The name of the class is more like a working title ;-) Realistically, I´d be for DB_DataObjectUtils - I wouldn´t like to have any reference to "Form" or "QuickForm" in the name, as I might add some more utility functions in the future that are not related to form generation. Opinions, votes? :-) CU Markus -- PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.pear.dev (#18632) next »